We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No match for request
I'm a novice so this may be a trivial question.
I'm currently trying to test my actions for signing up a user. For some reason my post request fails by timing out, when my endpoints seem to be fine.
// the test it('creates SIGNUP_USER_SUCCESS when user completes signup', (done) => { var signupUser = require('../actions/auth/signup').signupUser; nock('http://api.dockerhost') .post('/signup', { first_name: 'Robin', last_name: 'Kim', username: 'rokim8@gmail.com', password: 'password' }) .reply(200, { body: { user: { username: 'rokim8@gmail.com' } } }) const expectedActions = [ { type: constants.SIGNUP_USER_REQUEST }, { type: constants.SIGNUP_USER_SUCCESS } ]; const store = mockStore({ user: {}}, expectedActions, done); store.dispatch(signupUser('Robin Kim', 'rokim8@gmail.com', 'password')); }) // the action const signupUser = (name, username, password) => { const first_name = name.split(' ').slice(0, -1).join(' '); const last_name = name.split(' ').slice(-1).join(' '); const url = `http://api.dockerhost/signup`; const data = { first_name, last_name, username, password } return (dispatch) => { dispatch(signupUserRequest()); return request .post(url) .type('form') .send(data) .end() .then((response) => { console.log('the response', response) dispatch(signupUserSuccess()); return dispatch(loginUser(username, password, '/downloads')); }) .catch((error) => { console.log('error', error) // this is where I get the error return dispatch(signupUserFailure({ response: { statusText: error.response.body.errors.username.message, field: error.response.body.errors.username.path } })) }) } } // the error response `{ [Error: Nock: No match for request POST http://api.dockerhost/signup first_name=Robin&last_name=Kim&username=rokim8%40gmail.com&password=password] status: 404, statusCode: 404, response: undefined }` // the test log `Error: timeout of 2000ms exceeded. Ensure the done() callback is being called in this test.`
It seems like it simply cannot hit my /signup endpoint, but I'm unsure as to why.
The text was updated successfully, but these errors were encountered:
The problem is with nock. Based on my experience, I would advise you to use the DEBUG=nock.* env variables to see what is happening.
DEBUG=nock.*
Sorry, something went wrong.
No branches or pull requests
I'm a novice so this may be a trivial question.
I'm currently trying to test my actions for signing up a user. For some reason my post request fails by timing out, when my endpoints seem to be fine.
It seems like it simply cannot hit my /signup endpoint, but I'm unsure as to why.
The text was updated successfully, but these errors were encountered: