UNPKG

887 BJavaScriptView Raw
1/*
2 * common.js: Tests for common utility function in nconf.
3 *
4 * (C) 2011, Charlie Robbins
5 *
6 */
7
8var fs = require('fs'),
9 path = require('path'),
10 vows = require('vows'),
11 assert = require('assert'),
12 helpers = require('./helpers'),
13 nconf = require('../lib/nconf');
14
15var mergeDir = path.join(__dirname, 'fixtures', 'merge'),
16 files = fs.readdirSync(mergeDir).map(function (f) { return path.join(mergeDir, f) });
17
18vows.describe('nconf/common').addBatch({
19 "Using nconf.common module": {
20 "the loadFiles() method": {
21 topic: function () {
22 nconf.loadFiles(files, this.callback);
23 },
24 "should merge the files correctly": helpers.assertMerged
25 },
26 "the loadFilesSync() method": {
27 "should merge the files correctly": function () {
28 helpers.assertMerged(null, nconf.loadFilesSync(files));
29 }
30 }
31 }
32}).export(module);
\No newline at end of file