hapi-openapi
hapi-openapi copied to clipboard
Running tests against the petstore example gives 400 error code for the post (add) example
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
I expect the 400 is due to not having the correct input.