-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
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
Testing hapi routes with Tape #64
Comments
I pulled down the source code your provided and was able to run all 3 tests successfully. Can you provide any more information on the errors you are seeing? Now, I'm only seeing 3 tests and you mentioned 4 in your question but you only provided the working ones. I do have 1 failing test but it is still able to run without error. I'm assuming it fails because the call to For instance, you would want to follow the pattern in the first 2 tests: var options = {
method: 'GET',
path: '/'
};
server.inject(options, function (response) { ...
...
...
}); |
@adam-beck The routes I'm trying to test are test('checks GET request for our index.html', function (t) {
var options = {
method: 'GET',
url: '/'
}
Server.start((err, server) => {
if (err) {
console.log(err)
}
server.inject(options, function (response) {
t.equal(response.statusCode, 200, '200 status code returned - ✅')
server.stop(t.end)
})
})
}) And here's the fail message:
|
I don't think it's your test that is incorrect then. The actual implementation is what's causing the test to fail. Have you made any changes to |
I'll take a look at the routes and see if I've changed anything that might be the problem. Will let you know! |
I just pulled in the latest changes from the testServer branch of https://github.com/dwyl/image-uploads/tree/serverTest/examples/direct-upload and it appears to be working. |
As in all 3 tests are now passing? |
Yes. And this is with no changes to the
|
hmm that's strange! Must be something to do with my laptop. I switched to node |
@jackcarlisle Tests pass. do you need help with getting Coverage up? |
@nelsonic why does the Especially since when I ran
|
@adam-beck It was @nelsonic's commit dwyl/imgup@9400254 that made the final test pass 👍 |
I've written a hapi server and now I'm trying to test it. I've been able to write tests that pass for one of my routes but have been unsuccessful for the other two. Here are the routes I'm trying to test:
And here are my tests that pass for the '/s3_credentials' route:
If anyone has any experience with testing similar routes I'd really appreciate your advice!
Thanks!
Link to the source code
The text was updated successfully, but these errors were encountered: