fix(tests): fix test on new db engine

This commit is contained in:
Alexey Kasyanchuk 2021-06-16 14:22:19 +03:00
parent b4c2627ed5
commit 52a448ef09
2 changed files with 4 additions and 3 deletions

View File

@ -1,7 +1,7 @@
import { assert } from "chai";
const {pool} = require('../src/background/mysql')
describe("big table for check", () => {
describe("sphinx basic async api", () => {
let sphinx;
it("init", async function() {

View File

@ -66,9 +66,10 @@ describe("sphinx", () => {
const sphinx = await pool()
let promises = []
sphinx.query(`delete from feed where id >= 0`, () => {
for(let i = 0; i < 500; i++)
for(let i = 1; i < 501; i++)
promises.push(sphinx.query(`insert into feed(id, data) values(${i}, 'a')`))
Promise.all(promises).then(() => {
Promise.all(promises).then(async () => {
assert.equal((await sphinx.query(`select count(*) as cnt from feed`))[0].cnt, 500);
sphinx.query(`delete from feed where id >= 0`, async () => {
await sphinx.end()
done()