fix(product, integration-tests): Fix integration tests (#4674)

* fix(product, integration-tests): Fix integration tests

* improve test

* Create dirty-eagles-shop.md
This commit is contained in:
Adrien de Peretti
2023-08-02 13:44:53 +02:00
committed by GitHub
parent 7f1421c218
commit 4b80ba8a35
5 changed files with 158 additions and 113 deletions

View File

@@ -8,6 +8,7 @@ import productSeeder from "../../../../helpers/product-seeder"
import { simpleSalesChannelFactory } from "../../../../factories"
import { AxiosInstance } from "axios"
import { Modules, ModulesDefinition } from "@medusajs/modules-sdk"
jest.setTimeout(50000)
@@ -21,11 +22,14 @@ describe("/admin/products", () => {
let medusaProcess
let dbConnection
let express
let medusaContainer
beforeAll(async () => {
const cwd = path.resolve(path.join(__dirname, "..", "..", ".."))
dbConnection = await initDb({ cwd } as any)
const { app, port } = await bootstrapApp({ cwd })
const { app, port, container } = await bootstrapApp({ cwd })
medusaContainer = container
setPort(port)
express = app.listen(port, () => {
process.send?.(port)
@@ -39,6 +43,14 @@ describe("/admin/products", () => {
medusaProcess.kill()
})
it("Should have loaded the product module", function () {
const productRegistrationName =
ModulesDefinition[Modules.PRODUCT].registrationName
expect(
medusaContainer.hasRegistration(productRegistrationName)
).toBeTruthy()
})
describe("POST /admin/products", () => {
beforeEach(async () => {
await productSeeder(dbConnection)