Created
September 20, 2019 16:27
-
-
Save lwillmeth/9d4c157ff80fdf5e4e4a4e95c50d39f8 to your computer and use it in GitHub Desktop.
Example questioning the value of assertions while creating a contract
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// based on https://github.com/pact-foundation/pact-js/blob/master/examples/mocha/test/get-dogs.spec.js#L40-L75 | |
describe("get /dogs", () => { | |
it("returns the correct response", async () => { | |
await provider.addInteraction({ | |
state: "i have a list of dogs", | |
uponReceiving: "a request for all dogs", | |
withRequest: { | |
method: "GET", | |
path: "/dogs", | |
headers: { Accept: "application/json" }, | |
}, | |
willRespondWith: { | |
status: 200, | |
headers: { "Content-Type": "application/json" }, | |
body: EXPECTED_BODY | |
} | |
}) | |
const urlAndPort = { url: url, port: port } | |
return getMeDogs(urlAndPort) | |
// the response is stubbed, so why bother asserting it? | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment