If you want to check out a quick demo, feel free to download it here: https://stackblitz.com/edit/angular-vczzqp. Simply hit export in the top right corner and then in your preferred terminal run install
and ng test
with your favorite browser.
It seems like the internal timings of Jasmine are not aligning properly for the objects.
Below is a test along with the specific error that I encountered. You can find the full test class example under app/Test.
it('should return a GET_GENERIC_FAILED when the services throws', () => {
const action = new genericActions.GetAllGenericAction();
genericsService.getAllGenerics.and.returnValue(Observable.throw({}));
actions$.stream = hot('a', { a: action });
const expected = cold('b', { b: new genericActions.GetGenericFailedAction() });
expect(effects.getAllGenerics).toBeObservable(expected);
});
And here's the error message:
Expected
[Object({
frame: 0,
notification: Notification({
kind: 'N',
value: GetGenericFailedAction({
type: '[GENERIC] Get Generic Failed'
}),
error: undefined,
hasValue: true
})
}), Object({
frame: 0,
notification: Notification({
kind: 'C',
value: undefined,
error: undefined,
hasValue: false
})
})]
to equal
[Object({
frame: 0,
notification: Notification({
kind: 'N',
value: GetGenericFailedAction({
type: '[GENERIC] Get Generic Failed'
}),
error: undefined,
hasValue: true
})
})].
Your guidance on this matter would be highly appreciated.