Skip to content

Commit

Permalink
fix: fix seed tests that did not use knex
Browse files Browse the repository at this point in the history
  • Loading branch information
ZavenArra committed Feb 18, 2021
1 parent 2ffe6eb commit 1895bcf
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions __tests__/seed.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,16 @@ describe("Seed data into DB", () => {
});

it("Should have api key", async () => {
let r = await pool.query({
text: `select * from api_key where key = $1`,
values: [seed.apiKey]
});
expect(r).to.have.property('rows').that.have.lengthOf(1);
const r = await knex.table("api_key").select().where("key", seed.apiKey);
expect(r).lengthOf(1);
});


it("Should find a token", async () => {
expect(seed.token).to.have.property('id');
r = await pool.query(
`select * from token where id = '${seed.token.id}'`
)
expect(r)
.to.have.property('rows').to.have.lengthOf(1);
token = r.rows[0];
console.log('oo')
console.log(token)
const r = await knex.table("token").select().where("id", seed.token.id);
expect(r).lengthOf(1);
token = r[0];
expect(token)
.to.have.property('capture_id')
.to.equal(seed.capture.id);
Expand Down

0 comments on commit 1895bcf

Please sign in to comment.