Skip to content
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

Running tests against the petstore example gives 400 error code for the post (add) example #160

Open
crobby opened this issue May 30, 2019 · 1 comment

Comments

@crobby
Copy link

crobby commented May 30, 2019

After running the steps in the README to generate the sample petstore app, I run 'npm test' against it. I get several 501 errors, which are expected in this case since I have not yet added the handlers, but the tests for "addPet post operation" is failing with 400 (bad request). I would expect that to also fail in the same way as the others. It appears that the request is not even making it into my (unimplemented) handler.

Here's the output of my npm test

TAP version 13

/pets

test findPets get operation

ok 1 should be truthy
ok 2 should be truthy
not ok 3 Ok response status

operator: equal
expected: 200
actual:   501
at: Test.<anonymous> (/home/croberts/src/petstore/tests/pets.js:70:11)
stack: |-
  Error: Ok response status
      at Test.assert [as _assert] (/home/croberts/src/petstore/node_modules/tape/lib/test.js:226:54)
      at Test.bound [as _assert] (/home/croberts/src/petstore/node_modules/tape/lib/test.js:77:32)
      at Test.equal (/home/croberts/src/petstore/node_modules/tape/lib/test.js:386:10)
      at Test.bound [as equal] (/home/croberts/src/petstore/node_modules/tape/lib/test.js:77:32)
      at Test.<anonymous> (/home/croberts/src/petstore/tests/pets.js:70:11)
      at process._tickCallback (internal/process/next_tick.js:68:7)

...

test addPet post operation

ok 4 should be truthy
ok 5 should be truthy
not ok 6 Ok response status

operator: equal
expected: 200
actual:   400
at: Test.<anonymous> (/home/croberts/src/petstore/tests/pets.js:130:11)
stack: |-
  Error: Ok response status
      at Test.assert [as _assert] (/home/croberts/src/petstore/node_modules/tape/lib/test.js:226:54)
      at Test.bound [as _assert] (/home/croberts/src/petstore/node_modules/tape/lib/test.js:77:32)
      at Test.equal (/home/croberts/src/petstore/node_modules/tape/lib/test.js:386:10)
      at Test.bound [as equal] (/home/croberts/src/petstore/node_modules/tape/lib/test.js:77:32)
      at Test.<anonymous> (/home/croberts/src/petstore/tests/pets.js:130:11)
      at process._tickCallback (internal/process/next_tick.js:68:7)

...

/pets/{id}

test findPetById get operation

ok 7 should be truthy
ok 8 should be truthy
not ok 9 Ok response status

operator: equal
expected: 200
actual:   400
at: Test.<anonymous> (/home/croberts/src/petstore/tests/pets/{id}.js:70:11)
stack: |-
  Error: Ok response status
      at Test.assert [as _assert] (/home/croberts/src/petstore/node_modules/tape/lib/test.js:226:54)
      at Test.bound [as _assert] (/home/croberts/src/petstore/node_modules/tape/lib/test.js:77:32)
      at Test.equal (/home/croberts/src/petstore/node_modules/tape/lib/test.js:386:10)
      at Test.bound [as equal] (/home/croberts/src/petstore/node_modules/tape/lib/test.js:77:32)
      at Test.<anonymous> (/home/croberts/src/petstore/tests/pets/{id}.js:70:11)
      at process._tickCallback (internal/process/next_tick.js:68:7)

...

test deletePet delete operation

ok 10 should be truthy
ok 11 should be truthy
not ok 12 Ok response status

operator: equal
expected: 204
actual:   501
at: Test.<anonymous> (/home/croberts/src/petstore/tests/pets/{id}.js:130:11)
stack: |-
  Error: Ok response status
      at Test.assert [as _assert] (/home/croberts/src/petstore/node_modules/tape/lib/test.js:226:54)
      at Test.bound [as _assert] (/home/croberts/src/petstore/node_modules/tape/lib/test.js:77:32)
      at Test.equal (/home/croberts/src/petstore/node_modules/tape/lib/test.js:386:10)
      at Test.bound [as equal] (/home/croberts/src/petstore/node_modules/tape/lib/test.js:77:32)
      at Test.<anonymous> (/home/croberts/src/petstore/tests/pets/{id}.js:130:11)
      at process._tickCallback (internal/process/next_tick.js:68:7)

...

1..12

tests 12

pass 8

fail 4

@tlivings
Copy link
Contributor

I expect the 400 is due to not having the correct input.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants