Skip to content

Commit

Permalink
Made config parameter on Config object optional
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashleigh authored and bashleigh committed Jul 30, 2019
1 parent 51fbdef commit ea83091
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/__tests__/config.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,8 @@ describe('Config object', () => {
}),
).toEqual({ eighth: true });
});

it('Can instance without parameters', () => {
expect(new Config()).toBeInstanceOf(Config);
});
});
4 changes: 2 additions & 2 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ export class Config {
/**
* @param config
*/
constructor(config: {[s: string]: any}) {
Object.keys(config).forEach(key => this[key] = config[key]);
constructor(config?: {[s: string]: any}) {
if (config) Object.keys(config).forEach(key => this[key] = config[key]);
}

/**
Expand Down

0 comments on commit ea83091

Please sign in to comment.