Skip to content

Commit

Permalink
Merge pull request #54 from JoshuaMorris/add-reject-example-to-readme
Browse files Browse the repository at this point in the history
Add reject example to README
  • Loading branch information
mzabriskie authored Mar 21, 2019
2 parents f6df430 + 76949ff commit 8bdaec5
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,23 @@ describe('mocking axios requests', function () {
})
})


it('Should reject the request', funciton (done) {
const errorResp = {
status: 400,
response: { message: 'invalid data' }
}

moxios.wait(function () {
let request = moxios.requests.mostRecent()
request.reject(errorResp)
}).catch(function (err) {
equal(err.status, errorResp.status)
equal(err.response.message, errorResp.response.message)
done()
})
})
})
})
```

Expand Down

0 comments on commit 8bdaec5

Please sign in to comment.