Files
medusa-store/integration-tests/helpers/fixtures.ts
Stevche Radevski 1c3ef13371 feat: Add necessary middlewares for tax inclusive pricing (#7827)
We are adding tax inclusive pricing calculation when listing products.

Two things to keep in mind:
- `region_id` will be required if you request calculated prices.
- We won't accept `currency_code` anymore, as that will come from the region info (since ultimately a cart and its currency are tied to a region)

REF CORE-2376
DEPENDS ON #8003
2024-07-09 09:37:13 +00:00

60 lines
1.7 KiB
TypeScript

import { HttpTypes } from "@medusajs/types"
export const getProductFixture = (
overrides: Partial<HttpTypes.AdminCreateProduct>
) => ({
title: "Test fixture",
description: "test-product-description",
status: "draft",
// BREAKING: Images input changed from string[] to {url: string}[]
images: [{ url: "test-image.png" }, { url: "test-image-2.png" }],
tags: [{ value: "123" }, { value: "456" }],
// BREAKING: Options input changed from {title: string}[] to {title: string, values: string[]}[]
options: [
{ title: "size", values: ["large", "small"] },
{ title: "color", values: ["green"] },
],
variants: [
{
title: "Test variant",
prices: [
{
currency_code: "usd",
amount: 100,
},
{
currency_code: "eur",
amount: 45,
},
{
currency_code: "dkk",
amount: 30,
},
],
// BREAKING: Options input changed from {value: string}[] to {[optionTitle]: optionValue} map
options: {
size: "large",
color: "green",
},
},
],
...(overrides ?? {}),
})
export const getPricelistFixture = (overrides: Partial<any>) => {
return {
// BREAKING: `name` field was renamed to `title`
title: "Winter sales",
description: "Winter sale. 25% off selected items.",
type: "sale",
status: "active",
starts_at: "2022-07-01T00:00:00.000Z",
ends_at: "2022-07-31T00:00:00.000Z",
// BREAKING: There is no explicit customer_groups field in v2, we use rules instead
// BREAKING: Variant ID is required in prices
// BREAKING: Currency code is required in prices
prices: [],
...overrides,
}
}