Skip to content

Commit

Permalink
fix: integration tests modules expectations (medusajs#6848)
Browse files Browse the repository at this point in the history
**What**
- fix tests
- cleanup deprecated jest conf
  • Loading branch information
adrien2p authored Mar 27, 2024
1 parent 5d9aea0 commit d4d1f9b
Show file tree
Hide file tree
Showing 41 changed files with 41 additions and 63 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ medusaIntegrationTestRunner({
application_method: {
type: "fixed",
target_type: "order",
value: "100",
value: 100,
},
},
])
Expand Down Expand Up @@ -69,14 +69,14 @@ medusaIntegrationTestRunner({
})

it("should get all promotions and its count filtered", async () => {
const [createdPromotion] = await promotionModuleService.create([
await promotionModuleService.create([
{
code: "TEST",
type: PromotionType.STANDARD,
application_method: {
type: "fixed",
target_type: "order",
value: "100",
value: 100,
},
},
])
Expand All @@ -95,7 +95,6 @@ medusaIntegrationTestRunner({
created_at: expect.any(String),
application_method: {
id: expect.any(String),
promotion: expect.any(Object),
},
},
])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ medusaIntegrationTestRunner({
ends_at: expect.any(String),
budget: {
id: expect.any(String),
campaign: expect.any(Object),
type: "spend",
limit: 1000,
raw_limit: {
Expand Down
2 changes: 1 addition & 1 deletion packages/admin-ui/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
globals: {
"ts-jest": {
tsConfig: "tsconfig.spec.json",
tsconfig: "tsconfig.spec.json",
isolatedModules: false,
},
},
Expand Down
2 changes: 1 addition & 1 deletion packages/api-key/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module.exports = {
"^.+\\.[jt]s?$": [
"ts-jest",
{
tsConfig: "tsconfig.spec.json",
tsconfig: "tsconfig.spec.json",
isolatedModules: true,
},
],
Expand Down
2 changes: 1 addition & 1 deletion packages/auth/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports = {
"^.+\\.[jt]s?$": [
"ts-jest",
{
tsConfig: "tsconfig.spec.json",
tsconfig: "tsconfig.spec.json",
isolatedModules: true,
},
],
Expand Down
2 changes: 1 addition & 1 deletion packages/cache-inmemory/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = {
"^.+\\.[jt]s?$": [
"ts-jest",
{
tsConfig: "tsconfig.json",
tsconfig: "tsconfig.json",
isolatedModules: true,
},
],
Expand Down
2 changes: 1 addition & 1 deletion packages/cache-redis/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = {
"^.+\\.[jt]s?$": [
"ts-jest",
{
tsConfig: "tsconfig.json",
tsconfig: "tsconfig.json",
isolatedModules: true,
},
],
Expand Down
2 changes: 1 addition & 1 deletion packages/cart/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports = {
"^.+\\.[jt]s?$": [
"ts-jest",
{
tsConfig: "tsconfig.spec.json",
tsconfig: "tsconfig.spec.json",
isolatedModules: true,
},
],
Expand Down
2 changes: 1 addition & 1 deletion packages/core-flows/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = {
"^.+\\.[jt]s?$": [
"ts-jest",
{
tsConfig: "tsconfig.json",
tsconfig: "tsconfig.json",
isolatedModules: true,
},
],
Expand Down
2 changes: 1 addition & 1 deletion packages/currency/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module.exports = {
"^.+\\.[jt]s?$": [
"ts-jest",
{
tsConfig: "tsconfig.spec.json",
tsconfig: "tsconfig.spec.json",
isolatedModules: true,
},
],
Expand Down
2 changes: 1 addition & 1 deletion packages/customer/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
"^.+\\.[jt]s?$": [
"ts-jest",
{
tsConfig: "tsconfig.spec.json",
tsconfig: "tsconfig.spec.json",
isolatedModules: true,
},
],
Expand Down
2 changes: 1 addition & 1 deletion packages/event-bus-local/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = {
"^.+\\.[jt]s?$": [
"ts-jest",
{
tsConfig: "tsconfig.json",
tsconfig: "tsconfig.json",
isolatedModules: true,
},
],
Expand Down
2 changes: 1 addition & 1 deletion packages/event-bus-redis/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = {
"^.+\\.[jt]s?$": [
"ts-jest",
{
tsConfig: "tsconfig.json",
tsconfig: "tsconfig.json",
isolatedModules: true,
},
],
Expand Down
2 changes: 1 addition & 1 deletion packages/inventory-next/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = {
"^.+\\.[jt]s?$": [
"ts-jest",
{
tsConfig: "tsconfig.json",
tsconfig: "tsconfig.json",
isolatedModules: true,
},
],
Expand Down
2 changes: 1 addition & 1 deletion packages/inventory/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = {
"^.+\\.[jt]s?$": [
"ts-jest",
{
tsConfig: "tsconfig.json",
tsconfig: "tsconfig.json",
isolatedModules: true,
},
],
Expand Down
2 changes: 1 addition & 1 deletion packages/link-modules/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = {
"^.+\\.[jt]s?$": [
"ts-jest",
{
tsConfig: "tsconfig.json",
tsconfig: "tsconfig.json",
isolatedModules: true,
},
],
Expand Down
2 changes: 1 addition & 1 deletion packages/medusa-cli/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
globals: {
"ts-jest": {
tsConfig: "tsconfig.spec.json",
tsconfig: "tsconfig.spec.json",
isolatedModules: false,
},
},
Expand Down
2 changes: 1 addition & 1 deletion packages/medusa-core-utils/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
globals: {
"ts-jest": {
tsConfig: "tsconfig.spec.json",
tsconfig: "tsconfig.spec.json",
isolatedModules: false,
},
},
Expand Down
2 changes: 1 addition & 1 deletion packages/medusa-dev-cli/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
globals: {
"ts-jest": {
tsConfig: "tsconfig.spec.json",
tsconfig: "tsconfig.spec.json",
isolatedModules: false,
},
},
Expand Down
2 changes: 1 addition & 1 deletion packages/modules-sdk/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = {
"^.+\\.[jt]s?$": [
"ts-jest",
{
tsConfig: "tsconfig.json",
tsconfig: "tsconfig.json",
isolatedModules: true,
},
],
Expand Down
2 changes: 1 addition & 1 deletion packages/oas/openapi-typescript-codegen/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module.exports = {
globals: {
"ts-jest": {
tsConfig: "tsconfig.json",
tsconfig: "tsconfig.json",
isolatedModules: false,
},
},
Expand Down
2 changes: 1 addition & 1 deletion packages/orchestration/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = {
"^.+\\.[jt]s?$": [
"ts-jest",
{
tsConfig: "tsconfig.json",
tsconfig: "tsconfig.json",
isolatedModules: true,
},
],
Expand Down
2 changes: 1 addition & 1 deletion packages/order/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module.exports = {
"^.+\\.[jt]s?$": [
"ts-jest",
{
tsConfig: "tsconfig.spec.json",
tsconfig: "tsconfig.spec.json",
isolatedModules: true,
},
],
Expand Down
2 changes: 1 addition & 1 deletion packages/payment/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
"^.+\\.[jt]s?$": [
"ts-jest",
{
tsConfig: "tsconfig.spec.json",
tsconfig: "tsconfig.spec.json",
isolatedModules: true,
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,6 @@ moduleIntegrationTestRunner({
starts_at: updateDate,
prices: expect.arrayContaining([
expect.objectContaining({
price_list: expect.objectContaining({
id: expect.any(String),
}),
amount: 400,
currency_code: "EUR",
}),
Expand Down Expand Up @@ -449,9 +446,6 @@ moduleIntegrationTestRunner({
id: expect.any(String),
prices: expect.arrayContaining([
expect.objectContaining({
price_list: expect.objectContaining({
id: expect.any(String),
}),
amount: 400,
currency_code: "EUR",
}),
Expand Down Expand Up @@ -565,18 +559,12 @@ moduleIntegrationTestRunner({
value: "DE",
}),
]),
price_list: expect.objectContaining({
id: expect.any(String),
}),
amount: 400,
currency_code: "EUR",
}),
expect.objectContaining({
rules_count: 0,
price_rules: [],
price_list: expect.objectContaining({
id: expect.any(String),
}),
amount: 600,
currency_code: "EUR",
}),
Expand Down Expand Up @@ -698,9 +686,6 @@ moduleIntegrationTestRunner({
prices: expect.arrayContaining([
expect.objectContaining({
rules_count: 0,
price_list: expect.objectContaining({
id: expect.any(String),
}),
amount: 123,
currency_code: "EUR",
}),
Expand Down Expand Up @@ -809,9 +794,6 @@ moduleIntegrationTestRunner({
prices: expect.arrayContaining([
expect.objectContaining({
rules_count: 1,
price_list: expect.objectContaining({
id: expect.any(String),
}),
price_rules: [
expect.objectContaining({
value: "EU",
Expand Down Expand Up @@ -919,9 +901,6 @@ moduleIntegrationTestRunner({
}),
}),
]),
price_list: expect.objectContaining({
id: expect.any(String),
}),
amount: 123,
currency_code: "EUR",
}),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { SqlEntityManager } from "@mikro-orm/postgresql"
import { createRuleTypes } from "../../../__fixtures__/rule-type"
import { moduleIntegrationTestRunner, SuiteOptions } from "medusa-test-utils"
import { Modules } from "@medusajs/modules-sdk"
import { IPricingModuleService } from "@medusajs/types"

jest.setTimeout(30000)

moduleIntegrationTestRunner({
moduleName: Modules.PRICING,
testSuite: ({
Expand Down
2 changes: 1 addition & 1 deletion packages/pricing/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports = {
"^.+\\.[jt]s?$": [
"ts-jest",
{
tsConfig: "tsconfig.spec.json",
tsconfig: "tsconfig.spec.json",
isolatedModules: true,
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ moduleIntegrationTestRunner({
name: "campaign 1",
budget: expect.objectContaining({
id: expect.any(String),
campaign: expect.any(Object),
limit: 1000,
}),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -958,7 +958,6 @@ moduleIntegrationTestRunner({
code: "PROMOTION_1",
application_method: {
id: expect.any(String),
promotion: expect.any(Object),
type: "fixed",
},
},
Expand Down
2 changes: 1 addition & 1 deletion packages/promotion/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports = {
"^.+\\.[jt]s?$": [
"ts-jest",
{
tsConfig: "tsconfig.spec.json",
tsconfig: "tsconfig.spec.json",
isolatedModules: true,
},
],
Expand Down
2 changes: 1 addition & 1 deletion packages/region/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module.exports = {
"^.+\\.[jt]s?$": [
"ts-jest",
{
tsConfig: "tsconfig.spec.json",
tsconfig: "tsconfig.spec.json",
isolatedModules: true,
},
],
Expand Down
2 changes: 1 addition & 1 deletion packages/sales-channel/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module.exports = {
"^.+\\.[jt]s?$": [
"ts-jest",
{
tsConfig: "tsconfig.spec.json",
tsconfig: "tsconfig.spec.json",
isolatedModules: true,
},
],
Expand Down
2 changes: 1 addition & 1 deletion packages/stock-location-next/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = {
"^.+\\.[jt]s?$": [
"ts-jest",
{
tsConfig: "tsconfig.spec.json",
tsconfig: "tsconfig.spec.json",
isolatedModules: true,
},
],
Expand Down
2 changes: 1 addition & 1 deletion packages/stock-location/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module.exports = {
"^.+\\.[jt]s?$": [
"ts-jest",
{
tsConfig: "tsconfig.spec.json",
tsconfig: "tsconfig.spec.json",
isolatedModules: true,
},
],
Expand Down
2 changes: 1 addition & 1 deletion packages/store/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module.exports = {
"^.+\\.[jt]s?$": [
"ts-jest",
{
tsConfig: "tsconfig.spec.json",
tsconfig: "tsconfig.spec.json",
isolatedModules: true,
},
],
Expand Down
Loading

0 comments on commit d4d1f9b

Please sign in to comment.