I am using nock to mock my http requests.
My app is written using Redux + React.
import nock from "nock"
nock("http://localhost:8080")
.log(console.log)
.get("/fake/users/sign_in.json")
.reply(500, 'Error')
const doLogin = (browser) => {
return browser
.url("http://localhost:8080")
.waitForElementVisible('form', 1000)
.setValue('input[name=email]', 'foo@foo.com')
.setValue('input[name=password]', 'somepass')
.click('button[type=submit]')
.pause(500)
}
export default {
"Do login and receive success message": (browser) => {
doLogin(browser)
.assert.urlContains('panel')
.end()
}
}
When the request returns error 500 can not pass the test, but currently it passes. So I think that nock is not mocking the requests.