UNPKG

1 kBJavaScriptView Raw
1var should = require('should');
2var path = require('path');
3
4var Loader = require('..');
5
6function fixture(name) {
7 return path.resolve(path.join(__dirname, 'fixtures', 'fileLoader', name) + '.yaml');
8};
9
10describe('yaml-config-loader', function() {
11 describe('mergeConfiguration', function() {
12 it('should merge objects', function() {
13 var loader = new Loader();
14 var one = {
15 a: 'b',
16 c: 'd'
17 };
18 var two = {
19 c: 'e',
20 f: 'g'
21 };
22 var result = loader.mergeConifguration(one, two);
23 result.a.should.equal('b');
24 result.c.should.equal('e');
25 result.f.should.equal('g');
26 });
27 it('should merge arrays', function() {
28 var loader = new Loader();
29 var one = [
30 'a',
31 'b'
32 ];
33 var two = [
34 'c',
35 ];
36 var result = loader.mergeConifguration(one, two);
37 result[0].should.equal('a');
38 result[1].should.equal('b');
39 result[2].should.equal('c');
40 });
41 });
42});
43