mercredi 17 mars 2021

How to avoid Ember tests failing if endpoint returns 404?

The Context:

I have an ember app, which I just updated from 2.16 to 2.18.2 (latest from the 2.x versions). I have a stubby server for testing purposes.

The Problem

When running my tests, some endpoints returns an 404 (which is expected), but my test fails with the following log:

not ok 32 Chrome 79.0 - [undefined ms] - Global error: Uncaught Error: Ember Data Request GET http://127.0.0.1:8882/stubby/patito/214 returned a 404
Payload (Empty Content-Type)

What I have tried

I added mock endpoint to return some data. The problem here is adding too many and unnecessary data.

Is there any possible way to flag those 404 as expected since they are not needed for a particular test to pass?




Aucun commentaire:

Enregistrer un commentaire