diff --git a/projects/spectator/src/lib/mock.ts b/projects/spectator/src/lib/mock.ts index 52fe8ed6..10860cc7 100644 --- a/projects/spectator/src/lib/mock.ts +++ b/projects/spectator/src/lib/mock.ts @@ -70,7 +70,7 @@ export function installProtoMethods(mock: any, proto: any, createSpyFn: Funct /** * @publicApi */ -export function createSpyObject(type: Type | AbstractType, template?: Partial>): SpyObject { +export function createSpyObject(type: Type | AbstractType, template?: Partial): SpyObject { const mock: any = { ...template } || {}; installProtoMethods(mock, type.prototype, name => { @@ -90,7 +90,7 @@ export function createSpyObject(type: Type | AbstractType, template?: P /** * @publicApi */ -export function mockProvider(type: Type | AbstractType, properties?: Partial>): FactoryProvider { +export function mockProvider(type: Type | AbstractType, properties?: Partial): FactoryProvider { return { provide: type, useFactory: () => createSpyObject(type, properties) diff --git a/projects/spectator/src/lib/spectator-routing/initial-module.ts b/projects/spectator/src/lib/spectator-routing/initial-module.ts index 785cfb7f..9c51bf7a 100644 --- a/projects/spectator/src/lib/spectator-routing/initial-module.ts +++ b/projects/spectator/src/lib/spectator-routing/initial-module.ts @@ -14,14 +14,15 @@ import { RouterStub } from './router-stub'; */ export function initialRoutingModule(options: Required>): ModuleMetadata { const moduleMetadata = initialSpectatorModule(options); + const eventsSubject = new Subject(); if (options.stubsEnabled) { moduleMetadata.imports.push(RouterTestingModule); moduleMetadata.providers.push( options.mockProvider(RouterStub, { - events: new Subject(), + events: eventsSubject.asObservable(), emitRouterEvent(event: Event): void { - this.events.next(event); + eventsSubject.next(event); }, serializeUrl(): string { return '/';