Brian Lauber 9d07bc97ea
Removed some globals from tests (#3712)
* `chai` is no longer global

* sinon is no longer globally defined

* expect(..) is no longer defined globally

* Removed obsolete eslint hints about globals

* Removed unused variable ( `expect(..)` )
2020-03-08 19:48:23 -04:00

39 lines
1.1 KiB
JavaScript

'use strict';
const { expect } = require('chai');
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');
});
});
};