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:
committed by
GitHub
parent
7f1421c218
commit
4b80ba8a35
@@ -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)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
const { Modules } = require("@medusajs/modules-sdk")
|
||||
const DB_HOST = process.env.DB_HOST
|
||||
const DB_USERNAME = process.env.DB_USERNAME
|
||||
const DB_PASSWORD = process.env.DB_PASSWORD
|
||||
@@ -31,21 +32,21 @@ module.exports = {
|
||||
database_extra: { idle_in_transaction_session_timeout: 0 },
|
||||
},
|
||||
modules: {
|
||||
stockLocationService: {
|
||||
[Modules.STOCK_LOCATION]: {
|
||||
scope: "internal",
|
||||
resources: "shared",
|
||||
resolve: "@medusajs/stock-location",
|
||||
},
|
||||
inventoryService: {
|
||||
[Modules.INVENTORY]: {
|
||||
scope: "internal",
|
||||
resources: "shared",
|
||||
resolve: "@medusajs/inventory",
|
||||
},
|
||||
cacheService: {
|
||||
[Modules.CACHE]: {
|
||||
resolve: "@medusajs/cache-inmemory",
|
||||
options: { ttl: 5 },
|
||||
},
|
||||
productModuleService: {
|
||||
[Modules.PRODUCT]: {
|
||||
scope: "internal",
|
||||
resources: "shared",
|
||||
resolve: "@medusajs/product",
|
||||
|
||||
Reference in New Issue
Block a user