Hi, I’m using jest-pact to create a consumer pact ...
# pact-js
g
Hi, I’m using jest-pact to create a consumer pact but unsure how to pass parameters and use the path matcher, if the latter is needed. I have tried using the query property but feel that I shouldn’t need to even specify the query parameter for the generate value. Eg:
Copy code
describe('Customers', () => {
      it('returns customer data', async () => {
        const interaction = {
          state: 'Server is healthy',
          uponReceiving: 'Request Person',
          willRespondWith: {
            status: 200,
            body: like(responseData),
          },
          withRequest: {
            method: 'GET',
            path: term({
              generate: '/some/path?id=1234567',
              matcher: '/some/path?id=(w{7})',
            }),
          },
        }

        await provider.addInteraction(interaction)

        await client.getPerson('1234567').then((person) => {
          expect(person).toEqual(responseData)
        })
      })
    })
Could anyone advise please?
t
The path parameter is for the path.
Not for the query
But more importantly - what are you trying to do?
What’s wrong with:
Copy code
path: '/some/path?id=1234567',
?
You don’t need a matcher there, unless the provider is going to provide the id
g
Thanks, turns out I don’t need the term at all!