Unit testing subscribe method using jasmine in angular project
问题 I'm trying to test ngOnInit() method for the component that has a subscribe method: Component: import { Component, OnInit} from '@angular/core'; import { SharedDataService } from './../services/shared-data.service'; @Component({ selector: 'app-root', templateUrl: './app.component.html', styleUrls: ['./app.component.scss'] }) export class AppComponent implements OnInit { constructor(private sharedDataService: SharedDataService,) { } this.subscriptions = []; ngOnInit() { this.subscriptions.push