fix(tests): fix test on new db engine
This commit is contained in:
parent
b4c2627ed5
commit
52a448ef09
@ -1,7 +1,7 @@
|
|||||||
import { assert } from "chai";
|
import { assert } from "chai";
|
||||||
const {pool} = require('../src/background/mysql')
|
const {pool} = require('../src/background/mysql')
|
||||||
|
|
||||||
describe("big table for check", () => {
|
describe("sphinx basic async api", () => {
|
||||||
let sphinx;
|
let sphinx;
|
||||||
|
|
||||||
it("init", async function() {
|
it("init", async function() {
|
||||||
|
@ -66,9 +66,10 @@ describe("sphinx", () => {
|
|||||||
const sphinx = await pool()
|
const sphinx = await pool()
|
||||||
let promises = []
|
let promises = []
|
||||||
sphinx.query(`delete from feed where id >= 0`, () => {
|
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')`))
|
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 () => {
|
sphinx.query(`delete from feed where id >= 0`, async () => {
|
||||||
await sphinx.end()
|
await sphinx.end()
|
||||||
done()
|
done()
|
||||||
|
Loading…
Reference in New Issue
Block a user