|
1
|
import { medusaIntegrationTestRunner } from "@medusajs/test-utils" |
|
2
|
import { IFulfillmentModuleService } from "@medusajs/types" |
|
3
|
import { Modules } from "@medusajs/utils" |
|
4
|
import { createAdminUser } from "../../../helpers/create-admin-user" |
|
5
|
|
|
6
|
jest.setTimeout(100000) |
|
7
|
|
|
8
|
const env = {} |
|
9
|
const adminHeaders = { |
|
10
|
headers: { "x-medusa-access-token": "test_token" }, |
|
11
|
} |
|
12
|
|
|
13
|
medusaIntegrationTestRunner({ |
|
14
|
env, |
|
15
|
testSuite: ({ getContainer, api, dbConnection, dbUtils }) => { |
|
16
|
let service: IFulfillmentModuleService |
|
17
|
let container |
|
18
|
|
|
19
|
beforeAll(() => { |
|
20
|
container = getContainer() |
|
21
|
service = container.resolve(Modules.FULFILLMENT) |
|
22
|
}) |
|
23
|
|
|
24
|
beforeAll(async () => { |
|
25
|
await createAdminUser(dbConnection, adminHeaders, container) |
|
26
|
|
|
27
|
await dbUtils.snapshot() |
|
28
|
}) |
|
29
|
|
|
30
|
describe("GET /admin/fulfillment-providers", () => { |
|
31
|
it("should list all fulfillment providers", async () => { |
|
32
|
const response = await api.get( |
|
33
|
`/admin/fulfillment-providers`, |
|
34
|
adminHeaders |
|
35
|
) |
|
36
|
|
|
37
|
expect(response.status).toEqual(200) |
|
38
|
expect(response.data.fulfillment_providers).toEqual( |
|
39
|
expect.arrayContaining([ |
|
40
|
{ id: "manual_test-provider", is_enabled: true }, |
|
41
|
{ |
|
42
|
id: "manual-calculated_test-provider-calculated", |
|
43
|
is_enabled: true, |
|
44
|
}, |
|
45
|
]) |
|
46
|
) |
|
47
|
}) |
|
48
|
}) |
|
49
|
}, |
|
50
|
}) |