Is there a way to properly mock the websocket subject from Rxjs in Angular?
I have the following service, which is injected in few components:
import {Injectable} from '@angular/core';
import {webSocket} from "rxjs/webSocket";
@Injectable({
providedIn: 'root'
})
export class WebsocketApi {
public websocketSubject = webSocket("ws://localhost:8080");
constructor() {
this.subject.subscribe(
event => { // do stuff with the event }
);
}
}
Is there a way that I can easily mock the subject in my WebsocketApi spec file, or elsewhere?
Thanks.