How To Mock Rxjs Observable Websocket For Unit Tests
I am creating a web app unsing Angular 4 and RxJs. In one part of my code I am creating a websocket using: Observable.websocket(url); function. Here is my code: /** * Tries to
Solution 1:
As OP mentioned the answer was to use spies.
fakeSocket = new Subject<any>(); spyOn(Observable, 'webSocket').and.returnValue(fakeSocket);
Post a Comment for "How To Mock Rxjs Observable Websocket For Unit Tests"