|
| 1 | +import { assert } from 'chai' |
| 2 | +import { describe, it } from 'mocha' |
| 3 | +import { getConfiguredEnvironment } from '../envfile' |
| 4 | + |
| 5 | +describe('EnvFile', () => { |
| 6 | + it('should work without envfile', () => { |
| 7 | + const ret = getConfiguredEnvironment({ env: { TEST: 'TEST' } }) |
| 8 | + assert.deepEqual(ret, { TEST: 'TEST' }) |
| 9 | + }) |
| 10 | + it('should work with missing envfile', () => { |
| 11 | + const ret = getConfiguredEnvironment({ env: { TEST: 'TEST' }, envFile: 'NONEXISTINGFILE' }) |
| 12 | + assert.deepEqual(ret, { TEST: 'TEST' }) |
| 13 | + }) |
| 14 | + it('should merge envfile', () => { |
| 15 | + const ret = getConfiguredEnvironment({ env: { TEST: 'TEST' }, envFile: 'testproject/envfile' }) |
| 16 | + assert.deepEqual(ret, { TEST: 'TEST', TEST1: 'VALUE1', Test2: 'Value2' }) |
| 17 | + }) |
| 18 | + ;(process.platform === 'win32' ? it : it.skip)('should merge envfile on win32', () => { |
| 19 | + const ret = getConfiguredEnvironment({ env: { TEST1: 'TEST' }, envFile: 'testproject/envfile' }) |
| 20 | + assert.deepEqual(ret, { TEST1: 'TEST', Test2: 'Value2' }) |
| 21 | + }) |
| 22 | + ;(process.platform === 'win32' ? it : it.skip)('should merge envfile on win32 case insensitive', () => { |
| 23 | + const ret = getConfiguredEnvironment({ env: { Test1: 'TEST' }, envFile: 'testproject/envfile' }) |
| 24 | + assert.deepEqual(ret, { TEST1: 'TEST', Test2: 'Value2' }) |
| 25 | + }) |
| 26 | + ;(process.platform !== 'win32' ? it : it.skip)('should merge envfile on unix', () => { |
| 27 | + const ret = getConfiguredEnvironment({ env: { TEST1: 'TEST' }, envFile: 'testproject/envfile' }) |
| 28 | + assert.deepEqual(ret, { TEST1: 'TEST', Test2: 'Value2' }) |
| 29 | + }) |
| 30 | + ;(process.platform !== 'win32' ? it : it.skip)('should merge envfile on unix case insensitive', () => { |
| 31 | + const ret = getConfiguredEnvironment({ env: { Test1: 'TEST' }, envFile: 'testproject/envfile' }) |
| 32 | + assert.deepEqual(ret, { Test1: 'TEST', TEST1: 'VALUE1', Test2: 'Value2' }) |
| 33 | + }) |
| 34 | +}) |
0 commit comments