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 7bd9f10bef
commit 4bb4f1812c
3 changed files with 22 additions and 14 deletions

View File

@ -19,7 +19,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('');
});