diff --git a/projects/solace-message-client/src/lib/solace-message-client.module.ts b/projects/solace-message-client/src/lib/solace-message-client.module.ts index fff41a2..f9c7735 100644 --- a/projects/solace-message-client/src/lib/solace-message-client.module.ts +++ b/projects/solace-message-client/src/lib/solace-message-client.module.ts @@ -75,7 +75,7 @@ import {provideLogger} from './logger'; @NgModule({}) export class SolaceMessageClientModule { - constructor(@Inject(FORROOT_GUARD) _guard: any, _solaceMessageClient: SolaceMessageClient /** eager construction */) { // eslint-disable-line @typescript-eslint/no-empty-function + constructor(@Inject(FORROOT_GUARD) _guard: any) { // eslint-disable-line @typescript-eslint/no-empty-function } /** diff --git a/projects/solace-message-client/src/lib/solace-message-client.spec.ts b/projects/solace-message-client/src/lib/solace-message-client.spec.ts index d1ce749..4d5118a 100644 --- a/projects/solace-message-client/src/lib/solace-message-client.spec.ts +++ b/projects/solace-message-client/src/lib/solace-message-client.spec.ts @@ -66,6 +66,15 @@ describe('SolaceMessageClient', () => { await expectAsync(solaceMessageClient.session).toBeResolved(); }); + it('should not eagerly construct `SolaceMessageClient`', async () => { + TestBed.overrideProvider(SolaceMessageClient, { + useFactory: () => { + throw Error(); + }, + }); + expect(() => TestBed.inject(SolaceMessageClientModule)).not.toThrowError(); + }); + it('should allow to disconnect and re-connect from the Solace message broker', async () => { const solaceMessageClient = TestBed.inject(SolaceMessageClient); await simulateLifecycleEvent(SessionEventCode.UP_NOTICE);