**What** Update the `MedusaService` class, factory and types to remove the concept of main modules. The idea being that all method will be explicitly named and suffixes to represent the object you are trying to manipulate. This pr also includes various fixes in different modules Co-authored-by: Stevche Radevski <4820812+sradevski@users.noreply.github.com> Co-authored-by: Oli Juhl <59018053+olivermrbl@users.noreply.github.com>
47 lines
1.2 KiB
TypeScript
47 lines
1.2 KiB
TypeScript
import { createAdminUser } from "../../../../helpers/create-admin-user"
|
|
import { medusaIntegrationTestRunner } from "medusa-test-utils"
|
|
|
|
jest.setTimeout(50000)
|
|
|
|
const env = { MEDUSA_FF_MEDUSA_V2: true }
|
|
const adminHeaders = {
|
|
headers: { "x-medusa-access-token": "test_token" },
|
|
}
|
|
|
|
medusaIntegrationTestRunner({
|
|
env,
|
|
testSuite: ({ dbConnection, getContainer, api }) => {
|
|
describe("POST /admin/customer-groups", () => {
|
|
let appContainer
|
|
|
|
beforeAll(async () => {
|
|
appContainer = getContainer()
|
|
})
|
|
|
|
beforeEach(async () => {
|
|
await createAdminUser(dbConnection, adminHeaders, appContainer)
|
|
// await adminSeeder(dbConnection)
|
|
})
|
|
|
|
it("should create a customer group", async () => {
|
|
const response = await api.post(
|
|
`/admin/customer-groups`,
|
|
{
|
|
name: "VIP",
|
|
},
|
|
adminHeaders
|
|
)
|
|
|
|
expect(response.status).toEqual(200)
|
|
expect(response.data.customer_group).toEqual(
|
|
expect.objectContaining({
|
|
id: expect.any(String),
|
|
name: "VIP",
|
|
created_by: expect.any(String),
|
|
})
|
|
)
|
|
})
|
|
})
|
|
},
|
|
})
|