-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
37 lines (30 loc) · 1.08 KB
/
index.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
/*global describe, it, expect*/
'use strict';
const path = require('path');
const rimraf = require('rimraf');
module.exports = function(knex) {
describe('knex.seed.make', () => {
it('should create a new seed file with the make method', async () => {
const name = await knex.seed.make('test');
rimraf.sync(path.dirname(name));
expect(path.basename(name)).to.equal('test.js');
});
});
describe('knex.seed.run', () => {
it('should run all seed files in the configured seed directory', async () => {
const [data] = await knex.seed.run({
directory: 'test/integration/seed/test',
});
expect(path.basename(data[0])).to.equal('seed1.js');
expect(path.basename(data[1])).to.equal('seed2.js');
});
it('should run specific seed file in the configured seed directory', async () => {
const [data] = await knex.seed.run({
directory: 'test/integration/seed/test',
specific: 'seed2.js',
});
expect(data.length).to.equal(1);
expect(path.basename(data[0])).to.equal('seed2.js');
});
});
};