Skip to content

Commit

Permalink
Merge a2bcba3 into c3e051e
Browse files Browse the repository at this point in the history
  • Loading branch information
Goodluckhf committed Aug 11, 2019
2 parents c3e051e + a2bcba3 commit 50d9b2e
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
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 50d9b2e

Please sign in to comment.