Our server api has some special behaviour, in some cases it replies with an http error instead of a http 200 response with a proper body. This is legacy code, but on purpose. Not to break anything we need to handle with that. Since these are rare cases i want to simulate that and reuse it for unit tests as well.
I'm a developer, a community builder, and a relentless learner. I'm a Google Developer Expert in Angular, a Pluralsight author, a conference speaker, and a volunteer for women in tech groups. ❤️🍷📚
Our server api has some special behaviour, in some cases it replies with an http error instead of a http 200 response with a proper body. This is legacy code, but on purpose. Not to break anything we need to handle with that. Since these are rare cases i want to simulate that and reuse it for unit tests as well.
In a unit test you can simulate errors. Does something like this work for you?
github.com/alisaduncan/tutorial-an...