Reputation: 11
Need help on solving the above problem 'cannot GET /states' for http:/localhost:8081/states. I have gone through https://groups.google.com/forum/#!topic/pact-support/zGj8o6snf5c, it is very helpful but did not find the answer.
GitHub Repository URL:https://github.com/pactfoundation/pactjs/tree/master/examples/e2e
I have set up the Pact-js e2e example on my machine OS X EI Captain[10.11].
./node_modules/.bin/mocha test/consumer.spec.js
Got the successful output.Pact
when a call to list all animals from the Animal Service is made
and there are animals in the database
✓ returns a list of animals
when a call to the Animal Service is made to retreive a single animal by ID
and there is an animal in the DB with ID 1
✓ returns the animal
and there no animals in the database
✓ returns a 404
when interacting with Animal Service
✓ should validate the interactions and create a contract
node test/publish.js
. Got the successful output.Pact contract publishing complete!
Head over to https://test.pact.dius.com.au/ and login with
=> Username: dXfltyFMgNOFZAxr8io9wJ37iUpY42M
=> Password: O5AIZWxelWbLvqMd8PkAVycBJh2Psyg1
to see your published contracts.
npm run api
. Got the successful outputAnimal Profile Service listening on http://localhost:8081
Animal Matching Service listening on http://localhots:8080
./node_modules/.bin/mocha test/provider.spec.js
.Got the error here1) Uncaught error outside test suite
Pact Verification
Pact Verification Failed: Error: /Users/sakshi.rawal/work/pact-js/node_modules/@pact-foundation/pact-provider-verifier-darwin/lib/vendor/ruby/2.1.0/gems/json-1.8.3/lib/json/common.rb:155:in `parse': 757: unexpected token at 'Cannot GET /states (Faraday::ParsingError)
'
Can you please help me in resolving the error on step 4. Another question on Step 3 is when I click on the link in the output it does not ask for username and password.
Thanks,
Sakshi
Upvotes: 0
Views: 298
Reputation: 4065
Can you double check you have the latest code pulled down? Looks like a transitive depedency shifted which didn't like the existing content type. I patched it the other day.
Upvotes: 0
Reputation: 4065
Step 3 listed above is not necessary, it is simply to test and use the running APIs.
I suspect step 4 is unable to run the provider with the extra endpoints as it is already running on the same port in step 3 hence the failure. This would mean it is unable to find the endpoint /states during the verification process.
Close all processes and then run step 4 and this endpoint should be added, and the tests should pass.
Upvotes: 0