I've tested errors on queries/mutations like these for years, but just now, I got one error I can't seem to figure it out.
When I call this test, Apollo is throwing an error for the errorMock I've made. Has anyone ever got this error?
It's funny because other tests that uses the same logic are working just fine, just this one
it('should call errorHandler if getThirdPartyCompanies requests returns an error', fakeAsync(() => {
const spyOnHandleError = spyOn(component['errorHandlerService'], 'handleError');
component.getThirdPartyCompanies();
const op = controller.expectOne(thirdPartyCouriersGraphqlModel);
op.flush(
{
errors: [new GraphQLError('a')]
}
);
controller.verify();
tick(100);
flush();
expect(spyOnHandleError).toHaveBeenCalled();
}));
Any tips on why this is happening?
Thanks in advance!