Skip to content

Commit

Permalink
test(mergeAllConfigs): add more unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
tusharmath committed Jan 10, 2018
1 parent 04467f2 commit fbef4d0
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/mergeAllConfigs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,23 @@ describe('mergeAllConfigs()', () => {
}
assert.deepEqual(actual, expected)
})
it('should override ENV variables with cli configs', () => {
const process = {
argv: ['--port', '3000', '--maxRetries', '150'],
cwd: () => path.resolve(__dirname, 'stub-module'),
env: {
DEPLOYMENT: 'www.example.com',
NODE_ENV: 'production',
USER: 'root',
MAX_RETRIES: 999
}
}
const actual = mergeAllConfigs(process)
const expected = {
type: 'user',
port: 3000,
maxRetries: 150
}
assert.deepEqual(actual, expected)
})
})

0 comments on commit fbef4d0

Please sign in to comment.