subject and behaviorsubject in angular 8 karma test cases code example
Example: how to write test cases form behaviorsubject
import { Injectable } from '@angular/core';import { HttpClient } from '@angular/common/http';@Injectable({ providedIn: 'root'})export class UserService { public apiUrl = 'path/to/your/api'; constructor(private http: HttpClient) { } // Http request with GET method fetchUsers() { return this.http.get<any>(this.apiUrl); }}