Reputation: 10939
I have a component that takes NgZone as a provider. How can I make a provider for NgZone when creating the TestBed.
I tried this but the test is timing out
const mockNgZone = jasmine.createSpyObj('mockNgZone', ['run', 'runOutsideAngular'])
mockNgZone.run.and.callFake(fn => fn())
When I use this mockNgZone, the test is timing out with the error:
Disconnected (1 times), because no message in 10000 ms.
Electron 1.7.9 (Node 7.9.0) ERROR
Disconnected, because no message in 10000 ms.
Upvotes: 0
Views: 6810
Reputation: 39226
The run
and runOutsideAngular
methods of NgZone
return value from the executed function. So, please return some value from the callFake
function.
Example:-
mockNgZone.run.and.callFake(function () {return something;});
Upvotes: 2