Adds gift card line item generation

This commit is contained in:
Sebastian Rindom committed 2020-07-20 16:29:27 +02:00
1 parent df47da50fa
commit 4c9b876407
6 files changed
+85 -4

No files matched your search

@@ -44,4 +44,51 @@ describe("LineItemService", () => {
})
})
})
describe("generate with giftcard", () => {
let result
beforeAll(async () => {
jest.clearAllMocks()
const lineItemService = new LineItemService({
productVariantService: ProductVariantServiceMock,
productService: ProductServiceMock,
regionService: RegionServiceMock,
})
result = await lineItemService.generate(
IdMap.getId("giftCardVar"),
IdMap.getId("region-france"),
1,
{
name: "Test Name",
}
)
})
it("results correctly", () => {
expect(result).toEqual({
title: "Gift Card",
description: "100 USD",
thumbnail: "1234",
is_giftcard: true,
content: {
unit_price: 100,
variant: {
_id: IdMap.getId("giftCardVar"),
title: "100 USD",
},
product: {
_id: IdMap.getId("giftCardProd"),
title: "Gift Card",
thumbnail: "1234",
is_giftcard: true,
},
quantity: 1,
},
metadata: {
name: "Test Name",
},
quantity: 1,
})
})
})
})