Skip to content

Commit

Permalink
test(config): set extends global
Browse files Browse the repository at this point in the history
  • Loading branch information
ramonornela committed Dec 3, 2016
1 parent c9d4fb8 commit 1c52406
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/providers/config-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export abstract class ConfigBase implements Config {

if (!envExtend) {
envExtend = this.getEnvExtends(env);
}
}

// not extends
if (!envExtend) {
Expand Down
18 changes: 18 additions & 0 deletions test/config-spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,24 @@ describe('Module Config', () => {
expect(configExtendStaging.name).toEqual('George');
expect(configExtendStaging.age).toEqual(30);
}));


describe('Env extends global', () => {

beforeEach(() => {
configModule();
});

it('all prod extend dev', inject([Config], (config: any) => {
config.setEnvExtends('prod2', 'dev')
.set('my-config-extends', {name: 'Ramon'}, 'prod2');

let configExtendData = config.get('my-config-extends', 'prod2');
expect(configExtendData.name).toEqual('Ramon');
expect(configExtendData.age).toEqual(20);
}));
});

});

describe('Custom loader', () => {
Expand Down

0 comments on commit 1c52406

Please sign in to comment.