Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #169 from markstos/bump-cson-dep
Bump cson dep to try to fix travis builds.
- Loading branch information
Showing
9 changed files
with
105 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
|
||
// Test declaring deferred values. | ||
// The key config files involved here are: | ||
// test/config/default-array-merge.js | ||
// test/config/local-array-merge.js | ||
|
||
|
||
// Change the configuration directory for testing | ||
process.env.NODE_CONFIG_DIR = __dirname + '/config'; | ||
|
||
// Hardcode $NODE_ENV=test for testing | ||
process.env.NODE_ENV='test'; | ||
|
||
// Test for multi-instance applications | ||
process.env.NODE_APP_INSTANCE='array-merge'; | ||
|
||
// Because require'ing config creates and caches a global singleton, | ||
// We have to invalidate the cache to build new object based on the environment variables above | ||
var CONFIG = requireUncached('../lib/config'); | ||
|
||
// Dependencies | ||
var vows = require('vows'), | ||
assert = require('assert'); | ||
|
||
exports.DeferredTest = vows.describe('Tests for merging arrays').addBatch({ | ||
'Array merging tests Tests': { | ||
topic: function() { | ||
return CONFIG; | ||
}, | ||
|
||
'An empty array replaced by a full array should be replaced': function() { | ||
console.dir(CONFIG.arrayMerging); | ||
assert.deepEqual(CONFIG.arrayMerging.emptyArray, ['not empty anymore']); | ||
}, | ||
|
||
'An array with one value should be replaced wholeshole': function() { | ||
assert.deepEqual(CONFIG.arrayMerging.oneItem, ['replaced']); | ||
}, | ||
|
||
"An array replaced by an empty array should be replaced wholesale" : function () { | ||
assert.deepEqual(CONFIG.arrayMerging.removeMe, []); | ||
} | ||
|
||
} | ||
}); | ||
|
||
|
||
function requireUncached(module){ | ||
delete require.cache[require.resolve(module)]; | ||
return require(module); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
|
||
var defer = require('../../defer').deferConfig; | ||
|
||
var config = { | ||
arrayMerging: { | ||
emptyArray : [], | ||
oneItem : ['one'], | ||
removeMe : ['some value'], | ||
}, | ||
}; | ||
|
||
module.exports = config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
var config = { | ||
arrayMerging: { | ||
emptyArray : ['not empty anymore'], // override empty array with a value | ||
oneItem : ['replaced'], // Replace one item with another. | ||
removeMe : [], // Replace a full array with an empty one | ||
}, | ||
}; | ||
|
||
module.exports = config; |