fix: integration tests modules expectations (#6848)

**What**
- fix tests
- cleanup deprecated jest conf
This commit is contained in:
Adrien de Peretti authored and GitHub committed 2024-03-27 15:39:20 +00:00
1 parent 5d9aea053c
commit d4d1f9b2f2
41 files changed
+41 -63

No files matched your search

@@ -37,7 +37,7 @@ medusaIntegrationTestRunner({
application_method: { application_method: {
type: "fixed", type: "fixed",
target_type: "order", target_type: "order",
value: "100", value: 100,
}, },
}, },
]) ])
@@ -69,14 +69,14 @@ medusaIntegrationTestRunner({
}) })
it("should get all promotions and its count filtered", async () => { it("should get all promotions and its count filtered", async () => {
const [createdPromotion] = await promotionModuleService.create([ await promotionModuleService.create([
{ {
code: "TEST", code: "TEST",
type: PromotionType.STANDARD, type: PromotionType.STANDARD,
application_method: { application_method: {
type: "fixed", type: "fixed",
target_type: "order", target_type: "order",
value: "100", value: 100,
}, },
}, },
]) ])
@@ -95,7 +95,6 @@ medusaIntegrationTestRunner({
created_at: expect.any(String), created_at: expect.any(String),
application_method: { application_method: {
id: expect.any(String), id: expect.any(String),
promotion: expect.any(Object),
}, },
}, },
]) ])
@@ -75,7 +75,6 @@ medusaIntegrationTestRunner({
ends_at: expect.any(String), ends_at: expect.any(String),
budget: { budget: {
id: expect.any(String), id: expect.any(String),
campaign: expect.any(Object),
type: "spend", type: "spend",
limit: 1000, limit: 1000,
raw_limit: { raw_limit: {
+1 -1
View File
@@ -1,7 +1,7 @@
module.exports = { module.exports = {
globals: { globals: {
"ts-jest": { "ts-jest": {
tsConfig: "tsconfig.spec.json", tsconfig: "tsconfig.spec.json",
isolatedModules: false, isolatedModules: false,
}, },
}, },
+1 -1
View File
@@ -9,7 +9,7 @@ module.exports = {
"^.+\\.[jt]s?$": [ "^.+\\.[jt]s?$": [
"ts-jest", "ts-jest",
{ {
tsConfig: "tsconfig.spec.json", tsconfig: "tsconfig.spec.json",
isolatedModules: true, isolatedModules: true,
}, },
], ],
+1 -1
View File
@@ -10,7 +10,7 @@ module.exports = {
"^.+\\.[jt]s?$": [ "^.+\\.[jt]s?$": [
"ts-jest", "ts-jest",
{ {
tsConfig: "tsconfig.spec.json", tsconfig: "tsconfig.spec.json",
isolatedModules: true, isolatedModules: true,
}, },
], ],
+1 -1
View File
@@ -3,7 +3,7 @@ module.exports = {
"^.+\\.[jt]s?$": [ "^.+\\.[jt]s?$": [
"ts-jest", "ts-jest",
{ {
tsConfig: "tsconfig.json", tsconfig: "tsconfig.json",
isolatedModules: true, isolatedModules: true,
}, },
], ],
+1 -1
View File
@@ -3,7 +3,7 @@ module.exports = {
"^.+\\.[jt]s?$": [ "^.+\\.[jt]s?$": [
"ts-jest", "ts-jest",
{ {
tsConfig: "tsconfig.json", tsconfig: "tsconfig.json",
isolatedModules: true, isolatedModules: true,
}, },
], ],
+1 -1
View File
@@ -10,7 +10,7 @@ module.exports = {
"^.+\\.[jt]s?$": [ "^.+\\.[jt]s?$": [
"ts-jest", "ts-jest",
{ {
tsConfig: "tsconfig.spec.json", tsconfig: "tsconfig.spec.json",
isolatedModules: true, isolatedModules: true,
}, },
], ],
+1 -1
View File
@@ -3,7 +3,7 @@ module.exports = {
"^.+\\.[jt]s?$": [ "^.+\\.[jt]s?$": [
"ts-jest", "ts-jest",
{ {
tsConfig: "tsconfig.json", tsconfig: "tsconfig.json",
isolatedModules: true, isolatedModules: true,
}, },
], ],
+1 -1
View File
@@ -9,7 +9,7 @@ module.exports = {
"^.+\\.[jt]s?$": [ "^.+\\.[jt]s?$": [
"ts-jest", "ts-jest",
{ {
tsConfig: "tsconfig.spec.json", tsconfig: "tsconfig.spec.json",
isolatedModules: true, isolatedModules: true,
}, },
], ],
+1 -1
View File
@@ -8,7 +8,7 @@ module.exports = {
"^.+\\.[jt]s?$": [ "^.+\\.[jt]s?$": [
"ts-jest", "ts-jest",
{ {
tsConfig: "tsconfig.spec.json", tsconfig: "tsconfig.spec.json",
isolatedModules: true, isolatedModules: true,
}, },
], ],
+1 -1
View File
@@ -3,7 +3,7 @@ module.exports = {
"^.+\\.[jt]s?$": [ "^.+\\.[jt]s?$": [
"ts-jest", "ts-jest",
{ {
tsConfig: "tsconfig.json", tsconfig: "tsconfig.json",
isolatedModules: true, isolatedModules: true,
}, },
], ],
+1 -1
View File
@@ -3,7 +3,7 @@ module.exports = {
"^.+\\.[jt]s?$": [ "^.+\\.[jt]s?$": [
"ts-jest", "ts-jest",
{ {
tsConfig: "tsconfig.json", tsconfig: "tsconfig.json",
isolatedModules: true, isolatedModules: true,
}, },
], ],
+1 -1
View File
@@ -3,7 +3,7 @@ module.exports = {
"^.+\\.[jt]s?$": [ "^.+\\.[jt]s?$": [
"ts-jest", "ts-jest",
{ {
tsConfig: "tsconfig.json", tsconfig: "tsconfig.json",
isolatedModules: true, isolatedModules: true,
}, },
], ],
+1 -1
View File
@@ -3,7 +3,7 @@ module.exports = {
"^.+\\.[jt]s?$": [ "^.+\\.[jt]s?$": [
"ts-jest", "ts-jest",
{ {
tsConfig: "tsconfig.json", tsconfig: "tsconfig.json",
isolatedModules: true, isolatedModules: true,
}, },
], ],
+1 -1
View File
@@ -3,7 +3,7 @@ module.exports = {
"^.+\\.[jt]s?$": [ "^.+\\.[jt]s?$": [
"ts-jest", "ts-jest",
{ {
tsConfig: "tsconfig.json", tsconfig: "tsconfig.json",
isolatedModules: true, isolatedModules: true,
}, },
], ],
+1 -1
View File
@@ -1,7 +1,7 @@
module.exports = { module.exports = {
globals: { globals: {
"ts-jest": { "ts-jest": {
tsConfig: "tsconfig.spec.json", tsconfig: "tsconfig.spec.json",
isolatedModules: false, isolatedModules: false,
}, },
}, },
+1 -1
View File
@@ -1,7 +1,7 @@
module.exports = { module.exports = {
globals: { globals: {
"ts-jest": { "ts-jest": {
tsConfig: "tsconfig.spec.json", tsconfig: "tsconfig.spec.json",
isolatedModules: false, isolatedModules: false,
}, },
}, },
+1 -1
View File
@@ -1,7 +1,7 @@
module.exports = { module.exports = {
globals: { globals: {
"ts-jest": { "ts-jest": {
tsConfig: "tsconfig.spec.json", tsconfig: "tsconfig.spec.json",
isolatedModules: false, isolatedModules: false,
}, },
}, },
+1 -1
View File
@@ -3,7 +3,7 @@ module.exports = {
"^.+\\.[jt]s?$": [ "^.+\\.[jt]s?$": [
"ts-jest", "ts-jest",
{ {
tsConfig: "tsconfig.json", tsconfig: "tsconfig.json",
isolatedModules: true, isolatedModules: true,
}, },
], ],
@@ -1,7 +1,7 @@
module.exports = { module.exports = {
globals: { globals: {
"ts-jest": { "ts-jest": {
tsConfig: "tsconfig.json", tsconfig: "tsconfig.json",
isolatedModules: false, isolatedModules: false,
}, },
}, },
+1 -1
View File
@@ -3,7 +3,7 @@ module.exports = {
"^.+\\.[jt]s?$": [ "^.+\\.[jt]s?$": [
"ts-jest", "ts-jest",
{ {
tsConfig: "tsconfig.json", tsconfig: "tsconfig.json",
isolatedModules: true, isolatedModules: true,
}, },
], ],
+1 -1
View File
@@ -9,7 +9,7 @@ module.exports = {
"^.+\\.[jt]s?$": [ "^.+\\.[jt]s?$": [
"ts-jest", "ts-jest",
{ {
tsConfig: "tsconfig.spec.json", tsconfig: "tsconfig.spec.json",
isolatedModules: true, isolatedModules: true,
}, },
], ],
+1 -1
View File
@@ -8,7 +8,7 @@ module.exports = {
"^.+\\.[jt]s?$": [ "^.+\\.[jt]s?$": [
"ts-jest", "ts-jest",
{ {
tsConfig: "tsconfig.spec.json", tsconfig: "tsconfig.spec.json",
isolatedModules: true, isolatedModules: true,
}, },
], ],
@@ -296,9 +296,6 @@ moduleIntegrationTestRunner({
starts_at: updateDate, starts_at: updateDate,
prices: expect.arrayContaining([ prices: expect.arrayContaining([
expect.objectContaining({ expect.objectContaining({
price_list: expect.objectContaining({
id: expect.any(String),
}),
amount: 400, amount: 400,
currency_code: "EUR", currency_code: "EUR",
}), }),
@@ -449,9 +446,6 @@ moduleIntegrationTestRunner({
id: expect.any(String), id: expect.any(String),
prices: expect.arrayContaining([ prices: expect.arrayContaining([
expect.objectContaining({ expect.objectContaining({
price_list: expect.objectContaining({
id: expect.any(String),
}),
amount: 400, amount: 400,
currency_code: "EUR", currency_code: "EUR",
}), }),
@@ -565,18 +559,12 @@ moduleIntegrationTestRunner({
value: "DE", value: "DE",
}), }),
]), ]),
price_list: expect.objectContaining({
id: expect.any(String),
}),
amount: 400, amount: 400,
currency_code: "EUR", currency_code: "EUR",
}), }),
expect.objectContaining({ expect.objectContaining({
rules_count: 0, rules_count: 0,
price_rules: [], price_rules: [],
price_list: expect.objectContaining({
id: expect.any(String),
}),
amount: 600, amount: 600,
currency_code: "EUR", currency_code: "EUR",
}), }),
@@ -698,9 +686,6 @@ moduleIntegrationTestRunner({
prices: expect.arrayContaining([ prices: expect.arrayContaining([
expect.objectContaining({ expect.objectContaining({
rules_count: 0, rules_count: 0,
price_list: expect.objectContaining({
id: expect.any(String),
}),
amount: 123, amount: 123,
currency_code: "EUR", currency_code: "EUR",
}), }),
@@ -809,9 +794,6 @@ moduleIntegrationTestRunner({
prices: expect.arrayContaining([ prices: expect.arrayContaining([
expect.objectContaining({ expect.objectContaining({
rules_count: 1, rules_count: 1,
price_list: expect.objectContaining({
id: expect.any(String),
}),
price_rules: [ price_rules: [
expect.objectContaining({ expect.objectContaining({
value: "EU", value: "EU",
@@ -919,9 +901,6 @@ moduleIntegrationTestRunner({
}), }),
}), }),
]), ]),
price_list: expect.objectContaining({
id: expect.any(String),
}),
amount: 123, amount: 123,
currency_code: "EUR", currency_code: "EUR",
}), }),
@@ -1,9 +1,10 @@
import { SqlEntityManager } from "@mikro-orm/postgresql"
import { createRuleTypes } from "../../../__fixtures__/rule-type" import { createRuleTypes } from "../../../__fixtures__/rule-type"
import { moduleIntegrationTestRunner, SuiteOptions } from "medusa-test-utils" import { moduleIntegrationTestRunner, SuiteOptions } from "medusa-test-utils"
import { Modules } from "@medusajs/modules-sdk" import { Modules } from "@medusajs/modules-sdk"
import { IPricingModuleService } from "@medusajs/types" import { IPricingModuleService } from "@medusajs/types"
jest.setTimeout(30000)
moduleIntegrationTestRunner({ moduleIntegrationTestRunner({
moduleName: Modules.PRICING, moduleName: Modules.PRICING,
testSuite: ({ testSuite: ({
+1 -1
View File
@@ -10,7 +10,7 @@ module.exports = {
"^.+\\.[jt]s?$": [ "^.+\\.[jt]s?$": [
"ts-jest", "ts-jest",
{ {
tsConfig: "tsconfig.spec.json", tsconfig: "tsconfig.spec.json",
isolatedModules: true, isolatedModules: true,
}, },
], ],
@@ -70,7 +70,6 @@ moduleIntegrationTestRunner({
name: "campaign 1", name: "campaign 1",
budget: expect.objectContaining({ budget: expect.objectContaining({
id: expect.any(String), id: expect.any(String),
campaign: expect.any(Object),
limit: 1000, limit: 1000,
}), }),
}, },
@@ -958,7 +958,6 @@ moduleIntegrationTestRunner({
code: "PROMOTION_1", code: "PROMOTION_1",
application_method: { application_method: {
id: expect.any(String), id: expect.any(String),
promotion: expect.any(Object),
type: "fixed", type: "fixed",
}, },
}, },
+1 -1
View File
@@ -10,7 +10,7 @@ module.exports = {
"^.+\\.[jt]s?$": [ "^.+\\.[jt]s?$": [
"ts-jest", "ts-jest",
{ {
tsConfig: "tsconfig.spec.json", tsconfig: "tsconfig.spec.json",
isolatedModules: true, isolatedModules: true,
}, },
], ],
+1 -1
View File
@@ -9,7 +9,7 @@ module.exports = {
"^.+\\.[jt]s?$": [ "^.+\\.[jt]s?$": [
"ts-jest", "ts-jest",
{ {
tsConfig: "tsconfig.spec.json", tsconfig: "tsconfig.spec.json",
isolatedModules: true, isolatedModules: true,
}, },
], ],
+1 -1
View File
@@ -9,7 +9,7 @@ module.exports = {
"^.+\\.[jt]s?$": [ "^.+\\.[jt]s?$": [
"ts-jest", "ts-jest",
{ {
tsConfig: "tsconfig.spec.json", tsconfig: "tsconfig.spec.json",
isolatedModules: true, isolatedModules: true,
}, },
], ],
+1 -1
View File
@@ -3,7 +3,7 @@ module.exports = {
"^.+\\.[jt]s?$": [ "^.+\\.[jt]s?$": [
"ts-jest", "ts-jest",
{ {
tsConfig: "tsconfig.spec.json", tsconfig: "tsconfig.spec.json",
isolatedModules: true, isolatedModules: true,
}, },
], ],
+1 -1
View File
@@ -3,7 +3,7 @@ module.exports = {
"^.+\\.[jt]s?$": [ "^.+\\.[jt]s?$": [
"ts-jest", "ts-jest",
{ {
tsConfig: "tsconfig.spec.json", tsconfig: "tsconfig.spec.json",
isolatedModules: true, isolatedModules: true,
}, },
], ],
+1 -1
View File
@@ -9,7 +9,7 @@ module.exports = {
"^.+\\.[jt]s?$": [ "^.+\\.[jt]s?$": [
"ts-jest", "ts-jest",
{ {
tsConfig: "tsconfig.spec.json", tsconfig: "tsconfig.spec.json",
isolatedModules: true, isolatedModules: true,
}, },
], ],
+1 -1
View File
@@ -9,7 +9,7 @@ module.exports = {
"^.+\\.[jt]s?$": [ "^.+\\.[jt]s?$": [
"ts-jest", "ts-jest",
{ {
tsConfig: "tsconfig.spec.json", tsconfig: "tsconfig.spec.json",
isolatedModules: true, isolatedModules: true,
}, },
], ],
+1 -1
View File
@@ -3,7 +3,7 @@ module.exports = {
"^.+\\.[jt]s?$": [ "^.+\\.[jt]s?$": [
"ts-jest", "ts-jest",
{ {
tsConfig: "tsconfig.spec.json", tsconfig: "tsconfig.spec.json",
isolatedModules: true, isolatedModules: true,
}, },
], ],
@@ -21,6 +21,8 @@ const afterEach_ = async () => {
await TestDatabase.clearTables(sharedPgConnection) await TestDatabase.clearTables(sharedPgConnection)
} }
jest.setTimeout(50000)
describe("Workflow Orchestrator module", function () { describe("Workflow Orchestrator module", function () {
describe("Testing basic workflow", function () { describe("Testing basic workflow", function () {
let workflowOrcModule: IWorkflowEngineService let workflowOrcModule: IWorkflowEngineService
@@ -9,7 +9,7 @@ module.exports = {
"^.+\\.[jt]s?$": [ "^.+\\.[jt]s?$": [
"ts-jest", "ts-jest",
{ {
tsConfig: "tsconfig.spec.json", tsconfig: "tsconfig.spec.json",
isolatedModules: true, isolatedModules: true,
}, },
], ],
@@ -8,7 +8,7 @@ module.exports = {
"^.+\\.[jt]s?$": [ "^.+\\.[jt]s?$": [
"ts-jest", "ts-jest",
{ {
tsConfig: "tsconfig.spec.json", tsconfig: "tsconfig.spec.json",
isolatedModules: true, isolatedModules: true,
}, },
], ],
+1 -1
View File
@@ -3,7 +3,7 @@ module.exports = {
"^.+\\.[jt]s?$": [ "^.+\\.[jt]s?$": [
"ts-jest", "ts-jest",
{ {
tsConfig: "tsconfig.json", tsconfig: "tsconfig.json",
isolatedModules: true, isolatedModules: true,
}, },
], ],