criollo/integration-tests/http/README.md

28 lines
836 B
Markdown
Raw Normal View History

2024-10-09 12:41:16 +00:00
# Integration Tests
The `medusa-test-utils` package provides utility functions to create integration tests for your API routes and workflows.
For example:
```ts
2024-10-16 10:06:47 +00:00
import { medusaIntegrationTestRunner } from "medusa-test-utils";
2024-10-09 12:41:16 +00:00
medusaIntegrationTestRunner({
testSuite: ({ api, getContainer }) => {
describe("Custom endpoints", () => {
describe("GET /store/custom", () => {
it("returns correct message", async () => {
2024-10-16 10:06:47 +00:00
const response = await api.get(`/store/custom`);
expect(response.status).toEqual(200);
expect(response.data).toHaveProperty("message");
expect(response.data.message).toEqual("Hello, World!");
});
});
});
},
});
2024-10-09 12:41:16 +00:00
```
2024-10-16 10:06:47 +00:00
Learn more in [this documentation](https://docs.medusajs.com/v2/debugging-and-testing/testing-tools/integration-tests).