frontend/.pnpm-store/v3/files/8b/8efc0e8df71b1a77f60f5d892e54b6fa1b217f3a1b0dd409e195df0d72d04e67a65e9d2fa5ecfb905e71400f6f83f5391597d5e66a56444eab7c80bf98491d

22 lines
541 B
Plaintext

import { envReplace } from './env-replace';
const ENV = {
foo: 'foo_value',
bar: 'bar_value',
}
test.each([
['-${foo}-${bar}', '-foo_value-bar_value'],
['\\${foo}', '${foo}'],
['\\${zoo}', '${zoo}'],
['\\\\${foo}', '\\foo_value'],
])('success %s => %s', (settingValue, expected) => {
const actual = envReplace(settingValue, ENV);
expect(actual).toEqual(expected);
})
test('fail when the env variable is not found', () => {
expect(() => envReplace('${baz}', ENV)).toThrow(`Failed to replace env in config: \${baz}`);
})