nconf-lite/test/provider-save.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

31 lines
No EOL
715 B
JavaScript

/*
* provider-save-test.js: Ensures consistency for Provider `save` operations.
*
* (C) 2011, Charlie Robbins and the Contributors.
*
*/
var nconf = require('../lib/nconf');
//
// Expose `nconf.Mock`
//
require('./mocks/mock-store');
describe('nconf/provider/save', () => {
describe("When using nconf an instance of 'nconf.Provider' with a Mock store", () => {
var nconfMock = nconf.use('mock');
it("the save() method should actually save before responding", done => {
var mock = nconf.stores.mock;
mock.on('save', function () {
nconfMock.saved = true;
});
nconf.save(() => {
expect(nconfMock.saved).toBeTruthy();
done();
});
})
})
});