Skip to content

Commit

Permalink
Split response with and without matchers
Browse files Browse the repository at this point in the history
  • Loading branch information
Antonello Caboni committed Jun 4, 2019
1 parent 7f64f8b commit b09545b
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions examples/typescript/test/get-dog.spec.ts
Expand Up @@ -28,12 +28,17 @@ describe("The Dog API", () => {
pactfileWriteMode: "merge",
})

const kennelExample: Kennel =
const kennel: Kennel =
{
name: "my kennel",
dogs: eachLike<Dog>({name: "my dog"})
dogs: [{name: "my dog"}]
};
const EXPECTED_BODY = like(kennelExample)

const kennelWithMatchers = like(
{
...kennel,
dogs: eachLike(kennel.dogs[0])
});

before(() =>
provider.setup().then(opts => {
Expand Down Expand Up @@ -62,15 +67,15 @@ describe("The Dog API", () => {
headers: {
"Content-Type": "application/json",
},
body: EXPECTED_BODY,
body: kennelWithMatchers,
})

return provider.addInteraction(interaction)
})

it("returns the correct response", done => {
dogService.getMeDogs().then((response: any) => {
expect(response.data[0]).to.deep.eq(kennelExample)
expect(response.data[0]).to.deep.eq(kennel)
done()
}, done)
})
Expand Down

0 comments on commit b09545b

Please sign in to comment.