Initial commit of medusajs v2 rc2

This commit is contained in:
2024-10-09 18:11:16 +05:30
commit 5e1fbc2a4c
31 changed files with 30313 additions and 0 deletions

View File

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

View File

@ -0,0 +1,15 @@
import { medusaIntegrationTestRunner } from "medusa-test-utils"
jest.setTimeout(60 * 1000)
medusaIntegrationTestRunner({
inApp: true,
env: {},
testSuite: ({ api }) => {
describe("Ping", () => {
it("ping the server health endpoint", async () => {
const response = await api.get('/health')
expect(response.status).toEqual(200)
})
})
},
})