Skip to content

Commit

Permalink
fixup! perf: prefer use factory instead of use value when possible
Browse files Browse the repository at this point in the history
  • Loading branch information
H4ad committed Nov 17, 2023
1 parent 31a0b18 commit ae03ccc
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions packages/core/test/router/router-module.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,15 @@ describe('RouterModule', () => {

describe('register', () => {
it('should return a dynamic module with routes registered as a provider', () => {
const moduleRegistered = RouterModule.register(routes);
const provider = moduleRegistered.providers.find(
p => 'useFactory' in p && p.provide === ROUTES,
) as FactoryProvider;
expect(provider).to.not.be.undefined;
expect(provider.useFactory()).to.be.eq(routes);
expect(RouterModule.register(routes)).to.deep.equal({
module: RouterModule,
providers: [
{
provide: ROUTES,
useValue: routes,
},
],
});
});
});
describe('when instantiated', () => {
Expand Down

0 comments on commit ae03ccc

Please sign in to comment.