add some more tests around invalid config paths

This commit is contained in:
Joe Fleming 2016-03-17 11:35:09 -07:00
parent 96e5937178
commit 41e30817ff

View file

@ -51,6 +51,30 @@ describe('lib/config/config', function () {
expect(run).to.throwException();
});
it('should allow keys in the schema', function () {
var config = new Config(schema);
var run = function () {
config.set('test.client.host', 'http://0.0.0.0');
};
expect(run).to.not.throwException();
});
it('should not allow keys not in the schema', function () {
var config = new Config(schema);
var run = function () {
config.set('paramNotDefinedInTheSchema', true);
};
expect(run).to.throwException();
});
it('should not allow child keys not in the schema', function () {
var config = new Config(schema);
var run = function () {
config.set('test.client.paramNotDefinedInTheSchema', true);
};
expect(run).to.throwException();
});
it('should set defaults', function () {
var config = new Config(schema);
expect(config.get('test.enable')).to.be(true);