Skip to content

Commit

Permalink
Merge c58e512 into c3e051e
Browse files Browse the repository at this point in the history
  • Loading branch information
Goodluckhf committed Aug 11, 2019
2 parents c3e051e + c58e512 commit 12b351f
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 35 deletions.
47 changes: 14 additions & 33 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"license": "MIT",
"devDependencies": {
"@types/jest": "^24.0.15",
"@types/node": "^12.0.10",
"@types/node": "^12.7.0",
"@typescript-eslint/eslint-plugin": "^1.11.0",
"@typescript-eslint/parser": "^1.11.0",
"coveralls": "^3.0.4",
Expand Down
2 changes: 1 addition & 1 deletion src/instance-wrappers/factory-instance-wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export class FactoryInstanceWrapper extends InstanceWrapper {
public constructor(
contextModule,
{
dependencies,
dependencies = [],
factory,
...instanceWrapperArguments
}: FactoryInstanceWrapperArguments,
Expand Down
32 changes: 32 additions & 0 deletions src/integration-tests/one-module.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,4 +218,36 @@ describe('Inverse of Control: one module', function() {
expect(e).toBeInstanceOf(CircularDependencyError);
}
});

it('Should not throw error useClass without dependencies', () => {
const container = new IoCContainer();
const diManifest: ManifestInterface = {
moduleName: 'tesModule',
providers: [
{
token: 'TestServiceA',
useClass: TestServiceA,
},
],
};

container.loadManifests([diManifest]);
container.compile();
});

it('Should not throw error useFactory without dependencies', () => {
const container = new IoCContainer();
const diManifest: ManifestInterface = {
moduleName: 'tesModule',
providers: [
{
token: 'TestServiceA',
useFactory: () => true,
},
],
};

container.loadManifests([diManifest]);
container.compile();
});
});

0 comments on commit 12b351f

Please sign in to comment.