Merge branch 'master' into services

# Conflicts:
#	package-lock.json
This commit is contained in:
Alexey Kasyanchuk
2018-08-08 06:59:53 +03:00
28 changed files with 702 additions and 612 deletions

View File

@ -8,8 +8,8 @@ const forBigTable = require('../src/background/forBigTable')
describe("big table for check", () => {
let sphinx;
it("init", function() {
sphinx = pool()
it("init", async function() {
sphinx = await pool()
expect(sphinx)
})
@ -36,4 +36,8 @@ describe("big table for check", () => {
await forBigTable(sphinx, 'feed', record => records.push(record), null, 15)
expect(records.length === 13)
})
it("close", async function() {
await sphinx.end()
})
});

View File

@ -1,4 +1,6 @@
import {startApplication, stopApplication} from "../tests/application";
global.logT = (...args) => {console.log(...args)}
global.logTE = (...args) => {console.log('error', ...args)}
describe("application", () => {
before(startApplication);

View File

@ -1,4 +1,4 @@
import { expect } from "chai";
import { expect, assert } from "chai";
const mysql = require('mysql')
const config = require('../src/background/config')
@ -60,15 +60,29 @@ describe("sphinx", () => {
})
})
it("query limit", function(done) {
const sphinx = pool()
let promises = []
sphinx.query(`delete from feed where id >= 0`, () => {
for(let i = 0; i < 500; i++)
promises.push(sphinx.query(`insert into feed(id, data) values(${i}, 'a')`))
Promise.all(promises).then(() => {
sphinx.query(`delete from feed where id >= 0`, () => done())
it("query limit", function(done) {
const test = async () => {
const sphinx = await pool()
let promises = []
sphinx.query(`delete from feed where id >= 0`, () => {
for(let i = 0; i < 500; i++)
promises.push(sphinx.query(`insert into feed(id, data) values(${i}, 'a')`))
Promise.all(promises).then(() => {
sphinx.query(`delete from feed where id >= 0`, async () => {
await sphinx.end()
done()
})
})
})
})
}
test()
})
it("escape", function () {
assert.equal(sphinx.escape(`naru'to`), `'naru\\'to'`)
})
it("close pool", function(done) {
sphinx.end(done)
})
});