Skip to content

Commit

Permalink
Add test for promises in config files.
Browse files Browse the repository at this point in the history
  • Loading branch information
wwalser committed Nov 22, 2016
1 parent b49276a commit 17128e6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion test/db/migrate.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ var _ = require('lodash');
'db:migrate --coffee',
'db:migrate --config ../../support/tmp/config/config.json',
'db:migrate --config ' + Support.resolveSupportPath('tmp', 'config', 'config.json'),
'db:migrate --config ../../support/tmp/config/config.js'
'db:migrate --config ../../support/tmp/config/config.js',
'db:migrate --config ../../support/tmp/config/config-promise.js'
]).forEach(function (flag) {
var prepare = function (callback, options) {
options = _.assign({ config: {} }, options || {});
Expand All @@ -32,6 +33,11 @@ var _ = require('lodash');
if (flag.match(/config\.js$/)) {
configPath = configPath + 'config.js';
configContent = 'module.exports = ' + configContent;
} else if (flag.match(/config-promise\.js/)) {
configPath = configPath + 'config.js';
configContent = '' +
'var b = require("bluebird");' +
'module.exports = b.resolve(' + configContent + ');';
} else {
configPath = configPath + 'config.json';
}
Expand Down
8 changes: 7 additions & 1 deletion test/db/seed.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ var _ = require('lodash');
'db:seed --config ../../support/tmp/config/config.json --seed seedPerson.js',
'db:seed --seed seedPerson.js --config ' +
Support.resolveSupportPath('tmp', 'config', 'config.json'),
'db:seed --seed seedPerson.js --config ../../support/tmp/config/config.js'
'db:seed --seed seedPerson.js --config ../../support/tmp/config/config.js',
'db:seed --seed seedPerson.js --config ../../support/tmp/config/config-promise.js'
]).forEach(function (flag) {
var prepare = function (callback, options) {
options = _.assign({ config: {} }, options || {});
Expand All @@ -32,6 +33,11 @@ var _ = require('lodash');
if (flag.match(/config\.js$/)) {
configPath = configPath + 'config.js';
configContent = 'module.exports = ' + configContent;
} else if (flag.match(/config-promise\.js/)) {
configPath = configPath + 'config.js';
configContent = '' +
'var b = require("bluebird");' +
'module.exports = b.resolve(' + configContent + ');';
} else {
configPath = configPath + 'config.json';
}
Expand Down

0 comments on commit 17128e6

Please sign in to comment.