1_basic.ts (678B)
1 import * as assert from 'assert'; 2 3 import { Config } from '../src/config'; 4 5 describe('basic', () => { 6 it('process', () => { 7 const c = new Config(__dirname + '/testdata'); 8 c.process(); 9 assert.equal(c.get('FOO_BAR'), 'baz'); 10 assert.equal(c.get('BAZ_XYZZY'), 666); 11 }); 12 13 it('override_simple', () => { 14 const c = new Config(__dirname + '/testdata'); 15 c.process(); 16 const o = { 17 'FOO_BAR': 42, 18 } 19 c.override(o); 20 assert.equal(c.get('FOO_BAR'), 42); 21 }); 22 23 it('override_prefix', () => { 24 const c = new Config(__dirname + '/testdata'); 25 c.process(); 26 const o = { 27 'XXX_FOO_BAR': 42, 28 } 29 c.override(o, 'XXX_'); 30 assert.equal(c.get('FOO_BAR'), 42); 31 32 }); 33 });