|
1
|
import { medusaIntegrationTestRunner } from "@medusajs/test-utils" |
|
2
|
import { createAdminUser } from "../../../../helpers/create-admin-user" |
|
3
|
|
|
4
|
jest.setTimeout(50000) |
|
5
|
|
|
6
|
const env = {} |
|
7
|
const adminHeaders = { |
|
8
|
headers: { "x-medusa-access-token": "test_token" }, |
|
9
|
} |
|
10
|
|
|
11
|
medusaIntegrationTestRunner({ |
|
12
|
env, |
|
13
|
testSuite: ({ dbConnection, getContainer, api, dbUtils }) => { |
|
14
|
describe("POST /admin/customer-groups", () => { |
|
15
|
let appContainer |
|
16
|
|
|
17
|
beforeAll(async () => { |
|
18
|
appContainer = getContainer() |
|
19
|
await createAdminUser(dbConnection, adminHeaders, appContainer) |
|
20
|
// await adminSeeder(dbConnection) |
|
21
|
|
|
22
|
await dbUtils.snapshot() |
|
23
|
}) |
|
24
|
|
|
25
|
it("should create a customer group", async () => { |
|
26
|
const response = await api.post( |
|
27
|
`/admin/customer-groups`, |
|
28
|
{ |
|
29
|
name: "VIP", |
|
30
|
}, |
|
31
|
adminHeaders |
|
32
|
) |
|
33
|
|
|
34
|
expect(response.status).toEqual(200) |
|
35
|
expect(response.data.customer_group).toEqual( |
|
36
|
expect.objectContaining({ |
|
37
|
id: expect.any(String), |
|
38
|
name: "VIP", |
|
39
|
created_by: expect.any(String), |
|
40
|
}) |
|
41
|
) |
|
42
|
}) |
|
43
|
}) |
|
44
|
}, |
|
45
|
}) |