node-config-yaml
Version:
Yaml Config for Node.js based on config-yml package
32 lines (25 loc) • 871 B
JavaScript
require('should')
const decache = require('decache')
decache('js-yaml')
decache('yargs')
delete require.cache[require.resolve('../')]
let env = 'envvar'
process.env.ENVIRONMENT_ID = env
let path = 'test/configs/env.yml'
let config = require('../').load(path, {root: 'env'})
describe('Config env from env var', function () {
it('should have env variables at top', function () {
config.lower.should.equal(env)
config.upper.should.equal(env.toUpperCase())
})
it('should have env variables in obj', function () {
config.obj1.obj2.lower.should.equal(env)
config.obj1.obj2.upper.should.equal(env.toUpperCase())
})
it('should have env variables in obj', function () {
config.list1[0].should.equal(env)
config.list1[1].should.equal(env.toUpperCase())
})
delete process.env.ENVIRONMENT_ID
})