feat: customer module skeleton (#6126)

This commit is contained in:
Sebastian Rindom
2024-01-19 10:18:54 +00:00
committed by GitHub
parent a12c28b7d5
commit 12aa1737d5
47 changed files with 1157 additions and 0 deletions
@@ -0,0 +1,41 @@
import { ICustomerModuleService } from "@medusajs/types"
import { initialize } from "../../../../src/initialize"
import { DB_URL, MikroOrmWrapper } from "../../../utils"
jest.setTimeout(30000)
describe("Customer Module Service", () => {
let service: ICustomerModuleService
beforeEach(async () => {
await MikroOrmWrapper.setupDatabase()
service = await initialize({
database: {
clientUrl: DB_URL,
schema: process.env.MEDUSA_CUSTOMER_DB_SCHEMA,
},
})
})
afterEach(async () => {
await MikroOrmWrapper.clearDatabase()
})
describe("create", () => {
it("should create a customer", async () => {
const customerPromise = service.create({
first_name: "John",
last_name: "Doe",
})
await expect(customerPromise).resolves.toEqual(
expect.objectContaining({
id: expect.any(String),
first_name: "John",
last_name: "Doe",
})
)
})
})
})