Created
February 23, 2015 03:45
-
-
Save marcusoftnet/db5f368a80021327da29 to your computer and use it in GitHub Desktop.
Testing 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
var should = require("should"); | |
describe("Configuration", function() { | |
var validateConfig = function(config) { | |
should.exists(config.mode); | |
config.mode.should.not.be.emtpy; | |
should.exists(config.mongoUrl); | |
config.mongoUrl.should.not.be.emtpy; | |
should.exists(config.port); | |
config.port.should.not.be.emtpy; | |
should.exists(config.user); | |
config.user.should.not.be.emtpy; | |
should.exists(config.user.name); | |
config.user.name.should.not.be.emtpy; | |
should.exists(config.user.pass); | |
config.user.pass.should.not.be.emtpy; | |
}; | |
describe("Local configuration", function() { | |
var config = {}; | |
before(function(done) { | |
config = require("./config")("local"); | |
done(); | |
}); | |
it("loads local configuration default", function(done) { | |
var localConfig = require("./config")(); | |
localConfig.mode.should.equal("local"); | |
done(); | |
}); | |
it("loads config by parameter", function(done) { | |
config = require("./config")("local"); | |
config.mode.should.equal("local"); | |
done(); | |
}); | |
it("loads local configuration for unknown configurations", function(done) { | |
var config = require("./config")("unknown"); | |
config.mode.should.equal("local"); | |
done(); | |
}); | |
it("has all the valid properties", function(done) { | |
validateConfig(config); | |
done(); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment