Hi I'm running my Pact tests inside a docker conta...
# pact-js
b
Hi I'm running my Pact tests inside a docker container. And I'm having trouble running a basic Pact test.
Copy code
test(`makes a request`, async () => {
	jest.setTimeout(30000);

	// Arrange
	const expectedResult = `Hello World`;

	await mockProvider.addInteraction({
		state: `foo exists`,
		uponReceiving: `a request to get foo`,
		withRequest: {
			method: `GET`,
			path: `/foo`
		},
		willRespondWith: {
			status: 200,
			headers: {
				"Content-Type": regex({
					generate: `text/plain`,
					matcher: `text/plain;?.*`
				})
			},
			body: like(expectedResult)
		}
	});

	const request = await <http://axios.post|axios.post>(
		`${mockProvider.mockService.baseUrl}/foo`
	);

	console.log(request);
});
My Pact logs are:
Copy code
I, [2022-03-22T13:37:53.003897 #348]  INFO -- : Registered expected interaction GET /foo
W, [2022-03-22T13:38:22.980712 #348]  WARN -- : Verifying - actual interactions do not match expected interactions. 
Missing requests:
	GET /foo



W, [2022-03-22T13:38:22.980965 #348]  WARN -- : Missing requests:
	GET /foo



I, [2022-03-22T13:38:23.015926 #348]  INFO -- : Cleared interactions
Any ideas?? Do I need to expose a port on my container???
y
You are making a post request to your mock server but have registered an expectation of a GET request. You should be testing your client in your application which inside it, would call out to the providing service. You would traditionally set up your api interface so that you can pass in the provider service base url, and with pact you would pass in the mock providers base url to the api client. Hope that makes sense!
☝️ 2