-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathseed.spec.js
48 lines (36 loc) · 1.02 KB
/
seed.spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
const seed = require("./seed");
const pool = require("../server/database/database");
const {expect} = require("chai");
const Crypto = require('crypto');
const log = require("loglevel");
const knex = require("../server/database/knex");
// Run the seed, and check that it's working
describe("Seed data into DB", () => {
before(async () => {
await seed.clear();
await seed.seed();
});
after(async () => {
await seed.clear();
});
describe("Should find a token", () => {
let token;
before(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];
});
it("Token should match tree/entity id", () => {
expect(token)
.to.have.property('tree_id')
.to.equal(seed.tree.id);
expect(token)
.to.have.property('entity_id')
.to.equal(seed.wallet.id);
});
});
});