Comments (13)
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 server.inject
is incorrect in test('check our GET request for our index.html')
.
For instance, you would want to follow the pattern in the first 2 tests:
var options = {
method: 'GET',
path: '/'
};
server.inject(options, function (response) { ...
...
...
});
from learn-hapi.
@jackcarlisle https://travis-ci.org/dwyl/image-uploads/builds/159896238#L288
from learn-hapi.
@adam-beck The routes I'm trying to test are GET
requests to '/'
, '/s3_credentials'
and '/{param*}'
. I added a test for the index.html but I keep receiving a 404
fail when I try to run it. Here's the new test:
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:
TAP version 13
# checks our /s3_credentials GET endpoint
ok 1 200 status code returned - ✅
# checks POST to /s3_credentials returns 404
ok 2 404 status code returned - ✅
# checks GET request for our index.html
not ok 3 200 status code returned - ✅
---
operator: equal
expected: 200
actual: 404
...
from learn-hapi.
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 lib/routes.js
? That is what the test file is relying on (https://github.com/dwyl/image-uploads/blob/serverTest/examples/direct-upload/test/server.test.js).
from learn-hapi.
I'll take a look at the routes and see if I've changed anything that might be the problem. Will let you know!
from learn-hapi.
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.
from learn-hapi.
As in all 3 tests are now passing?
from learn-hapi.
Yes. And this is with no changes to the testServer
branch.
- node version:
v5.4.1
from learn-hapi.
hmm that's strange! Must be something to do with my laptop. I switched to node v5.4.1
but the problem still persists on my end. I'll look into it further. Thanks for taking the time to help!
from learn-hapi.
I did:
git clone git@github.com:dwyl/image-uploads.git
cd image-uploads/
git checkout serverTest
npm install
npm test
from learn-hapi.
@jackcarlisle git pull
on the branch...
Tests pass. do you need help with getting Coverage up?
from learn-hapi.
@nelsonic why does the git pull
step fix this?
Especially since when I ran git pull
from the serverTest
branch I received:
Already up-to-date.
from learn-hapi.
@adam-beck It was @nelsonic's commit dwyl/imgup@9400254 that made the final test pass 👍
from learn-hapi.
Related Issues (20)
- tidy up "badges" in readme?
- Hapi Pal - a bunch of Hapi plugins and tools all glommed together
- An in-range update of lab is breaking the build 🚨 HOT 3
- Ressource: hapipal.com HOT 3
- An in-range update of joi is breaking the build 🚨 HOT 15
- My application is 2 way SSL enabled but I want a single route in the app to be 1 way SSL HOT 1
- An in-range update of code is breaking the build 🚨 HOT 4
- An in-range update of handlebars is breaking the build 🚨 HOT 3
- An in-range update of socket.io is breaking the build 🚨 HOT 1
- Not able to register plugin in Hapi HOT 2
- Not able to register plugin in Hapi
- Cited video found irrelevant HOT 1
- broken HitCount
- update readme links
- update links HOT 1
- Add CONTRIBUTING.md File to Repo
- Handling File Uploads with Hapi.js HOT 2
- Update version of Hapi to latest
- Update tutorial to hapi v17 HOT 6
- Add temporary banner to note that this tutorial is not yet hapi v17? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from learn-hapi.