|
1 | 1 | import type { |
2 | 2 | CustomerGroupResourceIdentifier, |
3 | | - DiscountedPriceDraft, |
4 | 3 | PriceDraft, |
5 | 4 | PriceTierDraft, |
6 | | - ProductDiscountReference, |
7 | 5 | } from "@commercetools/platform-sdk"; |
8 | 6 | import { describe, expect, test } from "vitest"; |
9 | 7 | import { getBaseResourceProperties } from "~src/helpers"; |
@@ -174,70 +172,6 @@ describe("priceFromDraft", () => { |
174 | 172 | }); |
175 | 173 | }); |
176 | 174 |
|
177 | | - test("should handle discounted field when provided", () => { |
178 | | - // First create a product discount in storage |
179 | | - const productDiscount = { |
180 | | - ...getBaseResourceProperties(), |
181 | | - id: "product-discount-id", |
182 | | - name: { en: "Test Discount" }, |
183 | | - description: { en: "Test Discount Description" }, |
184 | | - value: { |
185 | | - type: "relative" as const, |
186 | | - permyriad: 2000, // 20% discount |
187 | | - }, |
188 | | - predicate: "1=1", |
189 | | - sortOrder: "0.1", |
190 | | - isActive: true, |
191 | | - references: [], |
192 | | - }; |
193 | | - storage.add("test-project", "product-discount", productDiscount); |
194 | | - |
195 | | - const discountedDraft: DiscountedPriceDraft = { |
196 | | - value: { |
197 | | - currencyCode: "EUR", |
198 | | - centAmount: 800, |
199 | | - }, |
200 | | - discount: { |
201 | | - typeId: "product-discount", |
202 | | - id: "product-discount-id", |
203 | | - }, |
204 | | - }; |
205 | | - |
206 | | - const draft: PriceDraft = { |
207 | | - value: { |
208 | | - currencyCode: "EUR", |
209 | | - centAmount: 1000, |
210 | | - }, |
211 | | - country: "NL", |
212 | | - discounted: discountedDraft, |
213 | | - }; |
214 | | - |
215 | | - const result = priceFromDraft(context, storage, draft); |
216 | | - |
217 | | - expect(result).toMatchObject({ |
218 | | - id: expect.any(String), |
219 | | - country: "NL", |
220 | | - value: { |
221 | | - type: "centPrecision", |
222 | | - currencyCode: "EUR", |
223 | | - centAmount: 1000, |
224 | | - fractionDigits: 2, |
225 | | - }, |
226 | | - discounted: { |
227 | | - value: { |
228 | | - type: "centPrecision", |
229 | | - currencyCode: "EUR", |
230 | | - centAmount: 800, |
231 | | - fractionDigits: 2, |
232 | | - }, |
233 | | - discount: { |
234 | | - typeId: "product-discount", |
235 | | - id: "product-discount-id", |
236 | | - }, |
237 | | - }, |
238 | | - }); |
239 | | - }); |
240 | | - |
241 | 175 | test("should handle custom field when provided", () => { |
242 | 176 | // First create a type in storage for custom fields |
243 | 177 | const customType = { |
|
0 commit comments