Skip to content

Commit 058c975

Browse files
committed
feat: test for multiple env overrides
1 parent 76ce3dc commit 058c975

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

app-config-extensions/src/extends-directive.test.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,4 +497,42 @@ describe('$override directive', () => {
497497
},
498498
);
499499
});
500+
501+
it('overrides env multiple files', async () => {
502+
await withTempFiles(
503+
{
504+
'test-file.yml': `
505+
foo:
506+
$env:
507+
default: 44
508+
dev: 88
509+
`,
510+
'test-file-2.yml': `
511+
bar:
512+
$env:
513+
default: 44
514+
dev: 88
515+
prod: 142
516+
`,
517+
},
518+
async (inDir) => {
519+
const source = new LiteralSource({
520+
$extends: [
521+
{
522+
path: inDir('test-file.yml'),
523+
env: 'development',
524+
},
525+
{
526+
path: inDir('test-file-2.yml'),
527+
env: 'production',
528+
},
529+
],
530+
});
531+
532+
const parsed = await source.read([envDirective(), extendsDirective()]);
533+
534+
expect(parsed.toJSON()).toEqual({ foo: 88, bar: 142 });
535+
},
536+
);
537+
});
500538
});

0 commit comments

Comments
 (0)