Testing redirect with Japa's api client is failing #3733
-
Hey everyone! I started a small project a few days ago and I'm being blocked with this issue that I replicated in this repo. As you can see the test is pretty simple, just calling an enpoint that redirects to another. The issue I'm seeing in the tests is this: [ info ] running tests...
❯ @japa/run-failed-tests: Running only 1 failed test(s)
{"level":30,"time":1652989564243,"pid":306395,"hostname":"pop-os","name":"redirect-test","msg":"started server on 0.0.0.0:38333"}
functional / Redirect (tests/functional/redirect.spec.ts)
✖ redirect works as expected (31ms)
FAILED
total : 1
failed : 1
duration : 37ms
✖ redirect works as expected
connect ECONNREFUSED 0.0.0.0:80
at TCPConnectWrap.afterConnect [as oncomplete] net.js:1148 As you can see the client tries to request at port 80 when the TestUtils' server is starting it at 38333. I added a nock to mock [ info ] running tests...
{"level":30,"time":1652990523948,"pid":323119,"hostname":"pop-os","name":"redirect-test","msg":"started server on 0.0.0.0:41419"}
functional / Redirect (tests/functional/redirect.spec.ts)
[ '0.0.0.0:/' ]
✔ redirect works as expected (42ms)
PASSED
total : 1
passed : 1
duration : 49ms I don't know if this is an issue of the Response/Redirect behavior in test environtment or maybe the ApiClient has the issue with the redirect. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Fixed in japa/api-client@9b20120 |
Beta Was this translation helpful? Give feedback.
Fixed in japa/api-client@9b20120