Files
medusa-store/integration-tests/modules/__tests__/fulfillment-providers/index.spec.ts
2024-07-03 06:30:56 -03:00

43 lines
1.2 KiB
TypeScript

import { IFulfillmentModuleService } from "@medusajs/types"
import { ModuleRegistrationName } from "@medusajs/utils"
import { medusaIntegrationTestRunner } from "medusa-test-utils"
import { createAdminUser } from "../../../helpers/create-admin-user"
jest.setTimeout(100000)
const env = { MEDUSA_FF_MEDUSA_V2: true }
const adminHeaders = {
headers: { "x-medusa-access-token": "test_token" },
}
medusaIntegrationTestRunner({
env,
testSuite: ({ getContainer, api, dbConnection }) => {
let service: IFulfillmentModuleService
let container
beforeAll(() => {
container = getContainer()
service = container.resolve(ModuleRegistrationName.FULFILLMENT)
})
beforeEach(async () => {
await createAdminUser(dbConnection, adminHeaders, container)
})
describe("GET /admin/fulfillment-providers", () => {
it("should list all fulfillment providers", async () => {
const response = await api.get(
`/admin/fulfillment-providers`,
adminHeaders
)
expect(response.status).toEqual(200)
expect(response.data.fulfillment_providers).toEqual([
{ id: "manual_test-provider", is_enabled: true },
])
})
})
},
})