Unit test Angular 2 service subject
I'm trying to write a test for an angular service which has a Subject property and a method to call .next() on that subject. The service is the following: @Injectable() export class SubjectService { serviceSubjectProperty$: Subject<any> = new Subject(); callNextOnSubject(data: any) { this.serviceSubjectProperty$.next(data); } } And the test file for that service: import { TestBed, inject } from '@angular/core/testing'; import { SubjectService } from './subject.service'; describe('SubjectService', () => { beforeEach(() => { TestBed.configureTestingModule({ providers: [ SubjectService ] }); });