Fix to make utils.readEnv more resilient to user input

This commit is contained in:
Shivam Mathur
2021-07-23 16:19:00 +05:30
parent 906893d397
commit 5227e2cd5c
3 changed files with 22 additions and 14 deletions

View File

@ -23,7 +23,11 @@ async function cleanup(path: string): Promise<void> {
describe('Utils tests', () => {
it('checking readEnv', async () => {
process.env['test'] = 'setup-php';
process.env['test-hyphen'] = 'setup-php';
expect(await utils.readEnv('test')).toBe('setup-php');
expect(await utils.readEnv('TEST')).toBe('setup-php');
expect(await utils.readEnv('test_hyphen')).toBe('setup-php');
expect(await utils.readEnv('TEST_HYPHEN')).toBe('setup-php');
expect(await utils.readEnv('undefined')).toBe('');
});