Skip to content

Commit

Permalink
partial feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
adrien2p committed Nov 3, 2022
1 parent 73f8cd8 commit d500d72
Show file tree
Hide file tree
Showing 11 changed files with 343 additions and 298 deletions.
2 changes: 1 addition & 1 deletion integration-tests/api/__tests__/admin/order/order.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const {
partial,
} = require("../../../helpers/call-helpers")

jest.setTimeout(30000)
jest.setTimeout(3000000)

describe("/admin/orders", () => {
let medusaProcess
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const TotalsNewServiceMock = {
export const newTotalsServiceMock = {
withTransaction: function () {
return this
},
Expand Down Expand Up @@ -36,7 +36,7 @@ export const TotalsNewServiceMock = {
}

const mock = jest.fn().mockImplementation(() => {
return TotalsNewServiceMock
return newTotalsServiceMock
})

export default mock
36 changes: 18 additions & 18 deletions packages/medusa/src/services/__tests__/cart.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { InventoryServiceMock } from "../__mocks__/inventory"
import { LineItemAdjustmentServiceMock } from "../__mocks__/line-item-adjustment"
import { FlagRouter } from "../../utils/flag-router"
import { taxProviderServiceMock } from "../__mocks__/tax-provider"
import { TotalsNewServiceMock } from "../__mocks__/totals-new"
import { newTotalsServiceMock } from "../__mocks__/new-totals"

const eventBusService = {
emit: jest.fn(),
Expand Down Expand Up @@ -60,7 +60,7 @@ describe("CartService", () => {
totalsService,
cartRepository,
taxProviderService: taxProviderServiceMock,
totalsNewService: TotalsNewServiceMock,
newTotalsService: newTotalsServiceMock,
featureFlagRouter: new FlagRouter({}),
})
result = await cartService.retrieve(IdMap.getId("emptyCart"))
Expand Down Expand Up @@ -95,7 +95,7 @@ describe("CartService", () => {
cartRepository,
eventBusService,
taxProviderService: taxProviderServiceMock,
totalsNewService: TotalsNewServiceMock,
newTotalsService: newTotalsServiceMock,
featureFlagRouter: new FlagRouter({}),
})

Expand Down Expand Up @@ -183,7 +183,7 @@ describe("CartService", () => {
totalsService,
cartRepository,
customerService,
totalsNewService: TotalsNewServiceMock,
newTotalsService: newTotalsServiceMock,
regionService,
eventBusService,
taxProviderService: taxProviderServiceMock,
Expand Down Expand Up @@ -355,7 +355,7 @@ describe("CartService", () => {
cartRepository,
lineItemService,
lineItemRepository: MockRepository(),
totalsNewService: TotalsNewServiceMock,
newTotalsService: newTotalsServiceMock,
eventBusService,
shippingOptionService,
inventoryService,
Expand Down Expand Up @@ -590,7 +590,7 @@ describe("CartService", () => {
cartRepository,
lineItemService,
lineItemRepository: MockRepository(),
totalsNewService: TotalsNewServiceMock,
newTotalsService: newTotalsServiceMock,
eventBusService,
shippingOptionService,
inventoryService,
Expand Down Expand Up @@ -689,7 +689,7 @@ describe("CartService", () => {
cartRepository,
lineItemService,
lineItemRepository: MockRepository(),
totalsNewService: TotalsNewServiceMock,
newTotalsService: newTotalsServiceMock,
shippingOptionService,
eventBusService,
lineItemAdjustmentService: LineItemAdjustmentServiceMock,
Expand Down Expand Up @@ -801,7 +801,7 @@ describe("CartService", () => {
totalsService,
eventBusService,
taxProviderService: taxProviderServiceMock,
totalsNewService: TotalsNewServiceMock,
newTotalsService: newTotalsServiceMock,
featureFlagRouter: new FlagRouter({}),
})

Expand Down Expand Up @@ -888,7 +888,7 @@ describe("CartService", () => {
cartRepository,
lineItemService,
eventBusService,
totalsNewService: TotalsNewServiceMock,
newTotalsService: newTotalsServiceMock,
inventoryService,
lineItemAdjustmentService: LineItemAdjustmentServiceMock,
taxProviderService: taxProviderServiceMock,
Expand Down Expand Up @@ -974,7 +974,7 @@ describe("CartService", () => {
cartRepository,
eventBusService,
customerService,
totalsNewService: TotalsNewServiceMock,
newTotalsService: newTotalsServiceMock,
taxProviderService: taxProviderServiceMock,
featureFlagRouter: new FlagRouter({}),
})
Expand Down Expand Up @@ -1051,7 +1051,7 @@ describe("CartService", () => {
cartRepository,
addressRepository,
eventBusService,
totalsNewService: TotalsNewServiceMock,
newTotalsService: newTotalsServiceMock,
taxProviderService: taxProviderServiceMock,
featureFlagRouter: new FlagRouter({}),
})
Expand Down Expand Up @@ -1112,7 +1112,7 @@ describe("CartService", () => {
totalsService,
cartRepository,
eventBusService,
totalsNewService: TotalsNewServiceMock,
newTotalsService: newTotalsServiceMock,
taxProviderService: taxProviderServiceMock,
featureFlagRouter: new FlagRouter({}),
})
Expand Down Expand Up @@ -1259,7 +1259,7 @@ describe("CartService", () => {
addressRepository,
totalsService,
cartRepository,
totalsNewService: TotalsNewServiceMock,
newTotalsService: newTotalsServiceMock,
regionService,
lineItemService,
lineItemAdjustmentService: LineItemAdjustmentServiceMock,
Expand Down Expand Up @@ -1356,7 +1356,7 @@ describe("CartService", () => {
cartRepository,
eventBusService,
taxProviderService: taxProviderServiceMock,
totalsNewService: TotalsNewServiceMock,
newTotalsService: newTotalsServiceMock,
featureFlagRouter: new FlagRouter({}),
})

Expand Down Expand Up @@ -1481,7 +1481,7 @@ describe("CartService", () => {
paymentProviderService,
eventBusService,
taxProviderService: taxProviderServiceMock,
totalsNewService: TotalsNewServiceMock,
newTotalsService: newTotalsServiceMock,
featureFlagRouter: new FlagRouter({}),
})

Expand Down Expand Up @@ -1673,7 +1673,7 @@ describe("CartService", () => {
lineItemService,
eventBusService,
customShippingOptionService,
totalsNewService: TotalsNewServiceMock,
newTotalsService: newTotalsServiceMock,
taxProviderService: taxProviderServiceMock,
featureFlagRouter: new FlagRouter({}),
})
Expand Down Expand Up @@ -2031,7 +2031,7 @@ describe("CartService", () => {
eventBusService,
lineItemAdjustmentService: LineItemAdjustmentServiceMock,
taxProviderService: taxProviderServiceMock,
totalsNewService: TotalsNewServiceMock,
newTotalsService: newTotalsServiceMock,
featureFlagRouter: new FlagRouter({}),
})

Expand Down Expand Up @@ -2306,7 +2306,7 @@ describe("CartService", () => {
cartRepository,
eventBusService,
taxProviderService: taxProviderServiceMock,
totalsNewService: TotalsNewServiceMock,
newTotalsService: newTotalsServiceMock,
featureFlagRouter: new FlagRouter({}),
})

Expand Down
24 changes: 12 additions & 12 deletions packages/medusa/src/services/__tests__/order.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { IdMap, MockManager, MockRepository } from "medusa-test-utils"
import OrderService from "../order"
import { InventoryServiceMock } from "../__mocks__/inventory"
import { LineItemServiceMock } from "../__mocks__/line-item"
import { TotalsNewServiceMock } from "../__mocks__/totals-new"
import { newTotalsServiceMock } from "../__mocks__/new-totals"

describe("OrderService", () => {
const totalsService = {
Expand Down Expand Up @@ -136,7 +136,7 @@ describe("OrderService", () => {
paymentProviderService,
shippingOptionService,
totalsService,
totalsNewService: TotalsNewServiceMock,
newTotalsService: newTotalsServiceMock,
discountService,
regionService,
eventBusService,
Expand Down Expand Up @@ -457,7 +457,7 @@ describe("OrderService", () => {
manager: MockManager,
orderRepository: orderRepo,
totalsService,
totalsNewService: TotalsNewServiceMock,
newTotalsService: newTotalsServiceMock,
})

beforeAll(async () => {
Expand All @@ -481,7 +481,7 @@ describe("OrderService", () => {
})
const orderService = new OrderService({
totalsService,
totalsNewService: TotalsNewServiceMock,
newTotalsService: newTotalsServiceMock,
manager: MockManager,
orderRepository: orderRepo,
})
Expand Down Expand Up @@ -524,7 +524,7 @@ describe("OrderService", () => {
})
const orderService = new OrderService({
totalsService,
totalsNewService: TotalsNewServiceMock,
newTotalsService: newTotalsServiceMock,
manager: MockManager,
orderRepository: orderRepo,
eventBusService,
Expand Down Expand Up @@ -636,7 +636,7 @@ describe("OrderService", () => {

const orderService = new OrderService({
totalsService,
totalsNewService: TotalsNewServiceMock,
newTotalsService: newTotalsServiceMock,
manager: MockManager,
orderRepository: orderRepo,
paymentProviderService,
Expand Down Expand Up @@ -737,7 +737,7 @@ describe("OrderService", () => {
orderRepository: orderRepo,
paymentProviderService,
totalsService,
totalsNewService: TotalsNewServiceMock,
newTotalsService: newTotalsServiceMock,
eventBusService,
})

Expand Down Expand Up @@ -857,7 +857,7 @@ describe("OrderService", () => {
fulfillmentService,
lineItemService,
totalsService,
totalsNewService: TotalsNewServiceMock,
newTotalsService: newTotalsServiceMock,
eventBusService,
})

Expand Down Expand Up @@ -1093,7 +1093,7 @@ describe("OrderService", () => {
orderRepository: orderRepo,
paymentProviderService,
totalsService,
totalsNewService: TotalsNewServiceMock,
newTotalsService: newTotalsServiceMock,
eventBusService,
})

Expand Down Expand Up @@ -1236,7 +1236,7 @@ describe("OrderService", () => {
eventBusService: eventBusService,
shippingOptionService: optionService,
totalsService,
totalsNewService: TotalsNewServiceMock,
newTotalsService: newTotalsServiceMock,
})

beforeEach(async () => {
Expand Down Expand Up @@ -1392,7 +1392,7 @@ describe("OrderService", () => {
manager: MockManager,
orderRepository: orderRepo,
totalsService,
totalsNewService: TotalsNewServiceMock,
newTotalsService: newTotalsServiceMock,
fulfillmentService,
lineItemService,
eventBusService,
Expand Down Expand Up @@ -1513,7 +1513,7 @@ describe("OrderService", () => {
orderRepository: orderRepo,
paymentProviderService,
totalsService,
totalsNewService: TotalsNewServiceMock,
newTotalsService: newTotalsServiceMock,
eventBusService,
})

Expand Down
Loading

0 comments on commit d500d72

Please sign in to comment.