Skip to content

Commit 182907c

Browse files
committed
feat: more test for $extendsSelf
1 parent 2ff4b8f commit 182907c

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

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

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,45 @@ describe('$extendsSelf directive', () => {
323323
});
324324
});
325325

326+
it('resolves with select and env option', async () => {
327+
const source = new LiteralSource({
328+
foo: {
329+
$env: {
330+
default: 'default',
331+
staging: 'staging',
332+
},
333+
},
334+
335+
bar: {
336+
$envVar: 'APP_CONFIG_ENV',
337+
},
338+
339+
baz: 'default',
340+
341+
$env: {
342+
default: {},
343+
qa: {
344+
$extendsSelf: {
345+
env: 'staging',
346+
select: '.',
347+
},
348+
349+
baz: 'qa',
350+
},
351+
},
352+
});
353+
354+
process.env.APP_CONFIG_ENV = 'qa';
355+
356+
expect(
357+
await source.readToJSON([extendsSelfDirective(), envVarDirective(), envDirective()]),
358+
).toEqual({
359+
foo: 'staging',
360+
bar: 'staging',
361+
baz: 'qa',
362+
});
363+
});
364+
326365
it('resolves a simple $extendsSelf selector', async () => {
327366
const source = new LiteralSource({
328367
foo: {

0 commit comments

Comments
 (0)