Giter Club home page Giter Club logo

Comments (13)

adam-beck avatar adam-beck commented on July 23, 2024 1

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.

nelsonic avatar nelsonic commented on July 23, 2024 1

@jackcarlisle https://travis-ci.org/dwyl/image-uploads/builds/159896238#L288
amen-brother-squirrel

from learn-hapi.

jackcarlisle avatar jackcarlisle commented on July 23, 2024

@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.

adam-beck avatar adam-beck commented on July 23, 2024

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.

jackcarlisle avatar jackcarlisle commented on July 23, 2024

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.

adam-beck avatar adam-beck commented on July 23, 2024

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.

jackcarlisle avatar jackcarlisle commented on July 23, 2024

As in all 3 tests are now passing?

from learn-hapi.

adam-beck avatar adam-beck commented on July 23, 2024

Yes. And this is with no changes to the testServer branch.

  • node version: v5.4.1

from learn-hapi.

jackcarlisle avatar jackcarlisle commented on July 23, 2024

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.

nelsonic avatar nelsonic commented on July 23, 2024

I did:

git clone git@github.com:dwyl/image-uploads.git
cd image-uploads/
git checkout serverTest
npm install
npm test

And got:
image-uploads-test-fails

from learn-hapi.

nelsonic avatar nelsonic commented on July 23, 2024

@jackcarlisle git pull on the branch...
test-pass-coverage-not-great

Tests pass. do you need help with getting Coverage up?

from learn-hapi.

adam-beck avatar adam-beck commented on July 23, 2024

@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.

iteles avatar iteles commented on July 23, 2024

@adam-beck It was @nelsonic's commit dwyl/imgup@9400254 that made the final test pass 👍

from learn-hapi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.