UNPKG

954 BJavaScriptView Raw
1var yargs = require('yargs');
2var path = require('path');
3var should = require('should');
4
5var Loader = require('../index');
6var loader = new Loader();
7
8describe('yaml-config-loader', function() {
9 describe('add', function() {
10 it('should detect the type added and add it appropriately', function(done) {
11
12 // First load default configuration.
13 loader.add(path.join(__dirname, 'fixtures', 'fileLoader', 'config1.yaml'));
14 loader.add(path.join(__dirname, 'fixtures', 'directoryLoader', 'valid'));
15 loader.add({'firstMate': 'William T. Riker'});
16 loader.load(function(error, config) {
17 should.not.exist(error);
18 config.captain.should.equal('Jean-Luc Picard');
19 config.firstMate.should.equal('William T. Riker');
20 config.doctor.should.equal('Beverly Crusher');
21 config.vulcan.should.equal('Spok');
22 config.android.should.equal('Data');
23 done(error);
24 });
25 });
26 });
27});
28