From 52a448ef0989c4c1231d2ca112300ad4be4c2301 Mon Sep 17 00:00:00 2001 From: Alexey Kasyanchuk Date: Wed, 16 Jun 2021 14:22:19 +0300 Subject: [PATCH] fix(tests): fix test on new db engine --- tests/sphinx.api.test.js | 2 +- tests/sphinx.test.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/tests/sphinx.api.test.js b/tests/sphinx.api.test.js index 42e5109..c4832eb 100644 --- a/tests/sphinx.api.test.js +++ b/tests/sphinx.api.test.js @@ -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() { diff --git a/tests/sphinx.test.js b/tests/sphinx.test.js index 7a74343..fab372f 100644 --- a/tests/sphinx.test.js +++ b/tests/sphinx.test.js @@ -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()