nconf-lite/test/common.test.js
Adrien Becchis b8686aeff0 Migrating test to jest (#292)
* set up jest dependencies

* add parser option to eslint to support es6

* migrate first test to jest

* migrate the argv test to shpec

* convert the env and literal store tests

* convert the file-store tests

* convert the memory-store tests

* convert the hierarchy tests

* convert the provider-save test

* convert the complete test

* convert the provider test

* convert the conf test

* tweak a test that was no longer working (context changed)

* replace in place the helpers file

* remove vows dependency

* update the test invocation to rely on jest

* update the argv test to be able to use the jest --verbose option

* Some tweaks to the test to have them working

* Update node version tested (+10 +12 -9)

* Replace const by var until we drop 0.10/0.12/4 node

* Replace let by var until we drop 0.10/0.12/4 node
2019-04-29 22:26:02 -04:00

28 lines
No EOL
845 B
JavaScript

/*
* common.js: Tests for common utility function in nconf.
*
* (C) 2011, Charlie Robbins and the Contributors.
*
*/
var fs = require('fs');
var path = require('path');
var helpers = require('./helpers');
var nconf = require('../lib/nconf');
var mergeDir = path.join(__dirname, 'fixtures', 'merge');
var files = fs.readdirSync(mergeDir).map(function (f) { return path.join(mergeDir, f) });
describe('nconf/common', () => {
describe('Using nconf.common module', () => {
it('the loadFiles() method should merge the files correctly', done => {
nconf.loadFiles(files, (err, res) => {
helpers.assertMerged(err, res);
done();
});
});
it("the loadFilesSync() method should merge the files correctly", () => {
helpers.assertMerged(null, nconf.loadFilesSync(files));
});
});
});