I read #484 and my case is a bit different
I have 12 passing tests, but the one below keeps throwing connect ECONNREFUSED 127.0.0.1:80
It's the only one that uses del so maybe that's the problem?
describe('deleteOne', () => {
it('should delete task', async done => {
const { token } = await createUser() // this works
const { _id } = await createTask(token) // this works
const res = await request(app)
.del(`api/tasks/${_id}`)
.set('authorization', 'Bearer ' + token)
expect(res.statusCode).toEqual(204)
done()
})
})
The reason can be incorrect route path.
For example:
Incorrect
request(server)
.post("api/user")
Correct
request(server)
.post("/api/user")
When I change the route, the error disappeared
Most helpful comment
The reason can be incorrect route path.
For example:
Incorrect
Correct
When I change the route, the error disappeared