All tests passes
This commit is contained in:
1 parent
9028a5afab
commit
fa6b131111
6 files changed
+31
No files matched your search
@@ -34,6 +34,7 @@ export default async (req, res) => {
|
|||||||
)
|
)
|
||||||
res.json({ products })
|
res.json({ products })
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
console.log(error)
|
||||||
throw error
|
throw error
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -88,6 +88,7 @@ export const orders = {
|
|||||||
title: "merge line",
|
title: "merge line",
|
||||||
description: "This is a new line",
|
description: "This is a new line",
|
||||||
thumbnail: "test-img-yeah.com/thumb",
|
thumbnail: "test-img-yeah.com/thumb",
|
||||||
|
returned_quantity: 0,
|
||||||
content: {
|
content: {
|
||||||
unit_price: 123,
|
unit_price: 123,
|
||||||
variant: {
|
variant: {
|
||||||
@@ -166,6 +167,7 @@ export const orders = {
|
|||||||
quantity: 1,
|
quantity: 1,
|
||||||
},
|
},
|
||||||
quantity: 10,
|
quantity: 10,
|
||||||
|
returned_quantity: 0,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
_id: IdMap.getId("existingLine2"),
|
_id: IdMap.getId("existingLine2"),
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
export const CounterServiceMock = {
|
||||||
|
getNext: jest.fn().mockImplementation(data => {
|
||||||
|
return Promise.resolve()
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
|
||||||
|
const mock = jest.fn().mockImplementation(() => {
|
||||||
|
return CounterServiceMock
|
||||||
|
})
|
||||||
|
|
||||||
|
export default mock
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
export const QueryBuilderServiceMock = {
|
||||||
|
buildQuery: jest.fn().mockImplementation(data => {
|
||||||
|
return Promise.resolve()
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
|
||||||
|
const mock = jest.fn().mockImplementation(() => {
|
||||||
|
return QueryBuilderServiceMock
|
||||||
|
})
|
||||||
|
|
||||||
|
export default mock
|
||||||
@@ -22,6 +22,9 @@ export const TotalsServiceMock = {
|
|||||||
}
|
}
|
||||||
return 0
|
return 0
|
||||||
}),
|
}),
|
||||||
|
getRefundedTotal: jest.fn().mockImplementation((order, lineItems) => {
|
||||||
|
return Promise.resolve()
|
||||||
|
}),
|
||||||
}
|
}
|
||||||
|
|
||||||
const mock = jest.fn().mockImplementation(() => {
|
const mock = jest.fn().mockImplementation(() => {
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import {
|
|||||||
import { ShippingProfileServiceMock } from "../__mocks__/shipping-profile"
|
import { ShippingProfileServiceMock } from "../__mocks__/shipping-profile"
|
||||||
import { TotalsServiceMock } from "../__mocks__/totals"
|
import { TotalsServiceMock } from "../__mocks__/totals"
|
||||||
import { RegionServiceMock } from "../__mocks__/region"
|
import { RegionServiceMock } from "../__mocks__/region"
|
||||||
|
import { CounterServiceMock } from "../__mocks__/counter"
|
||||||
import { EventBusServiceMock } from "../__mocks__/event-bus"
|
import { EventBusServiceMock } from "../__mocks__/event-bus"
|
||||||
|
|
||||||
describe("OrderService", () => {
|
describe("OrderService", () => {
|
||||||
@@ -46,6 +47,7 @@ describe("OrderService", () => {
|
|||||||
discountService: DiscountServiceMock,
|
discountService: DiscountServiceMock,
|
||||||
regionService: RegionServiceMock,
|
regionService: RegionServiceMock,
|
||||||
eventBusService: EventBusServiceMock,
|
eventBusService: EventBusServiceMock,
|
||||||
|
counterService: CounterServiceMock
|
||||||
})
|
})
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
@@ -468,6 +470,7 @@ describe("OrderService", () => {
|
|||||||
quantity: 10,
|
quantity: 10,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
metadata: {},
|
||||||
provider_id: "default_provider",
|
provider_id: "default_provider",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in new issue
Block a user