From f073d9f3371ce8badd41261a7636852a9943ae56 Mon Sep 17 00:00:00 2001 From: jaikamat Date: Tue, 3 Oct 2023 12:30:31 -0400 Subject: [PATCH] fix(test-data): use Money over CentPrecisionMoney in shipping rate drafts --- .changeset/hip-seals-sell.md | 5 +++++ .../sample-data-goodstore/express.spec.ts | 10 ---------- .../sample-data-goodstore/standard.spec.ts | 20 ------------------- .../presets/sample-data-goodstore/usa.spec.ts | 10 ---------- .../sample-data-goodstore/eur-10000.ts | 4 ++-- .../sample-data-goodstore/eur-50000.ts | 4 ++-- .../sample-data-goodstore/gbp-10000.ts | 4 ++-- .../sample-data-goodstore/gbp-50000.ts | 4 ++-- .../sample-data-goodstore/usd-5000.spec.ts | 10 ---------- .../presets/sample-data-goodstore/usd-5000.ts | 8 +++----- .../europe-express.spec.ts | 10 ---------- .../sample-data-goodstore/europe.spec.ts | 10 ---------- .../united-kingdom.spec.ts | 10 ---------- .../presets/sample-data-goodstore/usa.spec.ts | 10 ---------- 14 files changed, 16 insertions(+), 103 deletions(-) create mode 100644 .changeset/hip-seals-sell.md diff --git a/.changeset/hip-seals-sell.md b/.changeset/hip-seals-sell.md new file mode 100644 index 000000000..ec2f4a993 --- /dev/null +++ b/.changeset/hip-seals-sell.md @@ -0,0 +1,5 @@ +--- +'@commercetools-test-data/shipping-method': patch +--- + +Use Money over CentPrecisionMoney in Good Store shipping rate drafts diff --git a/models/shipping-method/src/shipping-method/shipping-method-draft/presets/sample-data-goodstore/express.spec.ts b/models/shipping-method/src/shipping-method/shipping-method-draft/presets/sample-data-goodstore/express.spec.ts index f29748364..8947394e5 100644 --- a/models/shipping-method/src/shipping-method/shipping-method-draft/presets/sample-data-goodstore/express.spec.ts +++ b/models/shipping-method/src/shipping-method/shipping-method-draft/presets/sample-data-goodstore/express.spec.ts @@ -26,8 +26,6 @@ describe('Shipping Method with express preset', () => { "price": { "centAmount": 50000, "currencyCode": "EUR", - "fractionDigits": 2, - "type": "centPrecision", }, "tiers": [], }, @@ -36,8 +34,6 @@ describe('Shipping Method with express preset', () => { "price": { "centAmount": 50000, "currencyCode": "GBP", - "fractionDigits": 2, - "type": "centPrecision", }, "tiers": [], }, @@ -75,22 +71,16 @@ describe('Shipping Method with express preset', () => { { "freeAbove": undefined, "price": { - "__typename": "Money", "centAmount": 50000, "currencyCode": "EUR", - "fractionDigits": 2, - "type": "centPrecision", }, "tiers": [], }, { "freeAbove": undefined, "price": { - "__typename": "Money", "centAmount": 50000, "currencyCode": "GBP", - "fractionDigits": 2, - "type": "centPrecision", }, "tiers": [], }, diff --git a/models/shipping-method/src/shipping-method/shipping-method-draft/presets/sample-data-goodstore/standard.spec.ts b/models/shipping-method/src/shipping-method/shipping-method-draft/presets/sample-data-goodstore/standard.spec.ts index d34fbbd92..d87d95fd5 100644 --- a/models/shipping-method/src/shipping-method/shipping-method-draft/presets/sample-data-goodstore/standard.spec.ts +++ b/models/shipping-method/src/shipping-method/shipping-method-draft/presets/sample-data-goodstore/standard.spec.ts @@ -26,8 +26,6 @@ describe('Shipping Method with standard preset', () => { "price": { "centAmount": 10000, "currencyCode": "EUR", - "fractionDigits": 2, - "type": "centPrecision", }, "tiers": [], }, @@ -36,8 +34,6 @@ describe('Shipping Method with standard preset', () => { "price": { "centAmount": 10000, "currencyCode": "GBP", - "fractionDigits": 2, - "type": "centPrecision", }, "tiers": [], }, @@ -54,8 +50,6 @@ describe('Shipping Method with standard preset', () => { "price": { "centAmount": 10000, "currencyCode": "GBP", - "fractionDigits": 2, - "type": "centPrecision", }, "tiers": [], }, @@ -64,8 +58,6 @@ describe('Shipping Method with standard preset', () => { "price": { "centAmount": 10000, "currencyCode": "EUR", - "fractionDigits": 2, - "type": "centPrecision", }, "tiers": [], }, @@ -103,22 +95,16 @@ describe('Shipping Method with standard preset', () => { { "freeAbove": undefined, "price": { - "__typename": "Money", "centAmount": 10000, "currencyCode": "EUR", - "fractionDigits": 2, - "type": "centPrecision", }, "tiers": [], }, { "freeAbove": undefined, "price": { - "__typename": "Money", "centAmount": 10000, "currencyCode": "GBP", - "fractionDigits": 2, - "type": "centPrecision", }, "tiers": [], }, @@ -134,22 +120,16 @@ describe('Shipping Method with standard preset', () => { { "freeAbove": undefined, "price": { - "__typename": "Money", "centAmount": 10000, "currencyCode": "GBP", - "fractionDigits": 2, - "type": "centPrecision", }, "tiers": [], }, { "freeAbove": undefined, "price": { - "__typename": "Money", "centAmount": 10000, "currencyCode": "EUR", - "fractionDigits": 2, - "type": "centPrecision", }, "tiers": [], }, diff --git a/models/shipping-method/src/shipping-method/shipping-method-draft/presets/sample-data-goodstore/usa.spec.ts b/models/shipping-method/src/shipping-method/shipping-method-draft/presets/sample-data-goodstore/usa.spec.ts index 9ccaafc7a..200764c3c 100644 --- a/models/shipping-method/src/shipping-method/shipping-method-draft/presets/sample-data-goodstore/usa.spec.ts +++ b/models/shipping-method/src/shipping-method/shipping-method-draft/presets/sample-data-goodstore/usa.spec.ts @@ -25,14 +25,10 @@ describe('Shipping Method with USA preset', () => { "freeAbove": { "centAmount": 100000, "currencyCode": "USD", - "fractionDigits": 2, - "type": "centPrecision", }, "price": { "centAmount": 5000, "currencyCode": "USD", - "fractionDigits": 2, - "type": "centPrecision", }, "tiers": undefined, }, @@ -69,18 +65,12 @@ describe('Shipping Method with USA preset', () => { "shippingRates": [ { "freeAbove": { - "__typename": "Money", "centAmount": 100000, "currencyCode": "USD", - "fractionDigits": 2, - "type": "centPrecision", }, "price": { - "__typename": "Money", "centAmount": 5000, "currencyCode": "USD", - "fractionDigits": 2, - "type": "centPrecision", }, "tiers": undefined, }, diff --git a/models/shipping-method/src/shipping-rate/shipping-rate-draft/presets/sample-data-goodstore/eur-10000.ts b/models/shipping-method/src/shipping-rate/shipping-rate-draft/presets/sample-data-goodstore/eur-10000.ts index 01c298cb8..e30519774 100644 --- a/models/shipping-method/src/shipping-rate/shipping-rate-draft/presets/sample-data-goodstore/eur-10000.ts +++ b/models/shipping-method/src/shipping-rate/shipping-rate-draft/presets/sample-data-goodstore/eur-10000.ts @@ -1,10 +1,10 @@ -import { CentPrecisionMoney } from '@commercetools-test-data/commons'; +import { Money } from '@commercetools-test-data/commons'; import { ShippingRateDraft } from '../../..'; const eur10000 = () => ShippingRateDraft.presets .empty() - .price(CentPrecisionMoney.random().currencyCode('EUR').centAmount(10000)) + .price(Money.presets.withCent().currencyCode('EUR').centAmount(10000)) .tiers([]); export default eur10000; diff --git a/models/shipping-method/src/shipping-rate/shipping-rate-draft/presets/sample-data-goodstore/eur-50000.ts b/models/shipping-method/src/shipping-rate/shipping-rate-draft/presets/sample-data-goodstore/eur-50000.ts index b5e3cade2..97407d67d 100644 --- a/models/shipping-method/src/shipping-rate/shipping-rate-draft/presets/sample-data-goodstore/eur-50000.ts +++ b/models/shipping-method/src/shipping-rate/shipping-rate-draft/presets/sample-data-goodstore/eur-50000.ts @@ -1,10 +1,10 @@ -import { CentPrecisionMoney } from '@commercetools-test-data/commons'; +import { Money } from '@commercetools-test-data/commons'; import { ShippingRateDraft } from '../../..'; const eur50000 = () => ShippingRateDraft.presets .empty() - .price(CentPrecisionMoney.random().currencyCode('EUR').centAmount(50000)) + .price(Money.presets.withCent().currencyCode('EUR').centAmount(50000)) .tiers([]); export default eur50000; diff --git a/models/shipping-method/src/shipping-rate/shipping-rate-draft/presets/sample-data-goodstore/gbp-10000.ts b/models/shipping-method/src/shipping-rate/shipping-rate-draft/presets/sample-data-goodstore/gbp-10000.ts index 868149883..99cb6fb54 100644 --- a/models/shipping-method/src/shipping-rate/shipping-rate-draft/presets/sample-data-goodstore/gbp-10000.ts +++ b/models/shipping-method/src/shipping-rate/shipping-rate-draft/presets/sample-data-goodstore/gbp-10000.ts @@ -1,10 +1,10 @@ -import { CentPrecisionMoney } from '@commercetools-test-data/commons'; +import { Money } from '@commercetools-test-data/commons'; import { ShippingRateDraft } from '../../..'; const gbp10000 = () => ShippingRateDraft.presets .empty() - .price(CentPrecisionMoney.random().currencyCode('GBP').centAmount(10000)) + .price(Money.presets.withCent().currencyCode('GBP').centAmount(10000)) .tiers([]); export default gbp10000; diff --git a/models/shipping-method/src/shipping-rate/shipping-rate-draft/presets/sample-data-goodstore/gbp-50000.ts b/models/shipping-method/src/shipping-rate/shipping-rate-draft/presets/sample-data-goodstore/gbp-50000.ts index 185ae1cbe..4a303b2da 100644 --- a/models/shipping-method/src/shipping-rate/shipping-rate-draft/presets/sample-data-goodstore/gbp-50000.ts +++ b/models/shipping-method/src/shipping-rate/shipping-rate-draft/presets/sample-data-goodstore/gbp-50000.ts @@ -1,10 +1,10 @@ -import { CentPrecisionMoney } from '@commercetools-test-data/commons'; +import { Money } from '@commercetools-test-data/commons'; import { ShippingRateDraft } from '../../..'; const gbp50000 = () => ShippingRateDraft.presets .empty() - .price(CentPrecisionMoney.random().currencyCode('GBP').centAmount(50000)) + .price(Money.presets.withCent().currencyCode('GBP').centAmount(50000)) .tiers([]); export default gbp50000; diff --git a/models/shipping-method/src/shipping-rate/shipping-rate-draft/presets/sample-data-goodstore/usd-5000.spec.ts b/models/shipping-method/src/shipping-rate/shipping-rate-draft/presets/sample-data-goodstore/usd-5000.spec.ts index 5e0a9c876..eb971f3f0 100644 --- a/models/shipping-method/src/shipping-rate/shipping-rate-draft/presets/sample-data-goodstore/usd-5000.spec.ts +++ b/models/shipping-method/src/shipping-rate/shipping-rate-draft/presets/sample-data-goodstore/usd-5000.spec.ts @@ -12,14 +12,10 @@ describe('with usd5000 preset', () => { "freeAbove": { "centAmount": 100000, "currencyCode": "USD", - "fractionDigits": 2, - "type": "centPrecision", }, "price": { "centAmount": 5000, "currencyCode": "USD", - "fractionDigits": 2, - "type": "centPrecision", }, "tiers": undefined, } @@ -32,18 +28,12 @@ describe('with usd5000 preset', () => { expect(usd5000PresetGraphql).toMatchInlineSnapshot(` { "freeAbove": { - "__typename": "Money", "centAmount": 100000, "currencyCode": "USD", - "fractionDigits": 2, - "type": "centPrecision", }, "price": { - "__typename": "Money", "centAmount": 5000, "currencyCode": "USD", - "fractionDigits": 2, - "type": "centPrecision", }, "tiers": undefined, } diff --git a/models/shipping-method/src/shipping-rate/shipping-rate-draft/presets/sample-data-goodstore/usd-5000.ts b/models/shipping-method/src/shipping-rate/shipping-rate-draft/presets/sample-data-goodstore/usd-5000.ts index 1060b31dc..0410e13cd 100644 --- a/models/shipping-method/src/shipping-rate/shipping-rate-draft/presets/sample-data-goodstore/usd-5000.ts +++ b/models/shipping-method/src/shipping-rate/shipping-rate-draft/presets/sample-data-goodstore/usd-5000.ts @@ -1,13 +1,11 @@ -import { CentPrecisionMoney } from '@commercetools-test-data/commons'; +import { Money } from '@commercetools-test-data/commons'; import type { TShippingRateDraftBuilder } from '../../../types'; import * as ShippingRateDraft from '../../index'; const usd5000 = (): TShippingRateDraftBuilder => ShippingRateDraft.presets .empty() - .price(CentPrecisionMoney.random().currencyCode('USD').centAmount(5000)) - .freeAbove( - CentPrecisionMoney.random().currencyCode('USD').centAmount(100000) - ); + .price(Money.presets.withCent().currencyCode('USD').centAmount(5000)) + .freeAbove(Money.presets.withCent().currencyCode('USD').centAmount(100000)); export default usd5000; diff --git a/models/shipping-method/src/zone-rate/zone-rate-draft/presets/sample-data-goodstore/europe-express.spec.ts b/models/shipping-method/src/zone-rate/zone-rate-draft/presets/sample-data-goodstore/europe-express.spec.ts index 324b303ed..489506f66 100644 --- a/models/shipping-method/src/zone-rate/zone-rate-draft/presets/sample-data-goodstore/europe-express.spec.ts +++ b/models/shipping-method/src/zone-rate/zone-rate-draft/presets/sample-data-goodstore/europe-express.spec.ts @@ -12,8 +12,6 @@ describe('with europeExpress preset', () => { "price": { "centAmount": 50000, "currencyCode": "EUR", - "fractionDigits": 2, - "type": "centPrecision", }, "tiers": [], }, @@ -22,8 +20,6 @@ describe('with europeExpress preset', () => { "price": { "centAmount": 50000, "currencyCode": "GBP", - "fractionDigits": 2, - "type": "centPrecision", }, "tiers": [], }, @@ -45,22 +41,16 @@ describe('with europeExpress preset', () => { { "freeAbove": undefined, "price": { - "__typename": "Money", "centAmount": 50000, "currencyCode": "EUR", - "fractionDigits": 2, - "type": "centPrecision", }, "tiers": [], }, { "freeAbove": undefined, "price": { - "__typename": "Money", "centAmount": 50000, "currencyCode": "GBP", - "fractionDigits": 2, - "type": "centPrecision", }, "tiers": [], }, diff --git a/models/shipping-method/src/zone-rate/zone-rate-draft/presets/sample-data-goodstore/europe.spec.ts b/models/shipping-method/src/zone-rate/zone-rate-draft/presets/sample-data-goodstore/europe.spec.ts index b442acb7a..f376101ef 100644 --- a/models/shipping-method/src/zone-rate/zone-rate-draft/presets/sample-data-goodstore/europe.spec.ts +++ b/models/shipping-method/src/zone-rate/zone-rate-draft/presets/sample-data-goodstore/europe.spec.ts @@ -12,8 +12,6 @@ describe('with europe preset', () => { "price": { "centAmount": 10000, "currencyCode": "EUR", - "fractionDigits": 2, - "type": "centPrecision", }, "tiers": [], }, @@ -22,8 +20,6 @@ describe('with europe preset', () => { "price": { "centAmount": 10000, "currencyCode": "GBP", - "fractionDigits": 2, - "type": "centPrecision", }, "tiers": [], }, @@ -44,22 +40,16 @@ describe('with europe preset', () => { { "freeAbove": undefined, "price": { - "__typename": "Money", "centAmount": 10000, "currencyCode": "EUR", - "fractionDigits": 2, - "type": "centPrecision", }, "tiers": [], }, { "freeAbove": undefined, "price": { - "__typename": "Money", "centAmount": 10000, "currencyCode": "GBP", - "fractionDigits": 2, - "type": "centPrecision", }, "tiers": [], }, diff --git a/models/shipping-method/src/zone-rate/zone-rate-draft/presets/sample-data-goodstore/united-kingdom.spec.ts b/models/shipping-method/src/zone-rate/zone-rate-draft/presets/sample-data-goodstore/united-kingdom.spec.ts index 68d6c6df4..4cd8c6706 100644 --- a/models/shipping-method/src/zone-rate/zone-rate-draft/presets/sample-data-goodstore/united-kingdom.spec.ts +++ b/models/shipping-method/src/zone-rate/zone-rate-draft/presets/sample-data-goodstore/united-kingdom.spec.ts @@ -12,8 +12,6 @@ describe('with unitedKingdom preset', () => { "price": { "centAmount": 10000, "currencyCode": "GBP", - "fractionDigits": 2, - "type": "centPrecision", }, "tiers": [], }, @@ -22,8 +20,6 @@ describe('with unitedKingdom preset', () => { "price": { "centAmount": 10000, "currencyCode": "EUR", - "fractionDigits": 2, - "type": "centPrecision", }, "tiers": [], }, @@ -45,22 +41,16 @@ describe('with unitedKingdom preset', () => { { "freeAbove": undefined, "price": { - "__typename": "Money", "centAmount": 10000, "currencyCode": "GBP", - "fractionDigits": 2, - "type": "centPrecision", }, "tiers": [], }, { "freeAbove": undefined, "price": { - "__typename": "Money", "centAmount": 10000, "currencyCode": "EUR", - "fractionDigits": 2, - "type": "centPrecision", }, "tiers": [], }, diff --git a/models/shipping-method/src/zone-rate/zone-rate-draft/presets/sample-data-goodstore/usa.spec.ts b/models/shipping-method/src/zone-rate/zone-rate-draft/presets/sample-data-goodstore/usa.spec.ts index e8c515f97..ff2002242 100644 --- a/models/shipping-method/src/zone-rate/zone-rate-draft/presets/sample-data-goodstore/usa.spec.ts +++ b/models/shipping-method/src/zone-rate/zone-rate-draft/presets/sample-data-goodstore/usa.spec.ts @@ -11,14 +11,10 @@ describe('with usa preset', () => { "freeAbove": { "centAmount": 100000, "currencyCode": "USD", - "fractionDigits": 2, - "type": "centPrecision", }, "price": { "centAmount": 5000, "currencyCode": "USD", - "fractionDigits": 2, - "type": "centPrecision", }, "tiers": undefined, }, @@ -38,18 +34,12 @@ describe('with usa preset', () => { "shippingRates": [ { "freeAbove": { - "__typename": "Money", "centAmount": 100000, "currencyCode": "USD", - "fractionDigits": 2, - "type": "centPrecision", }, "price": { - "__typename": "Money", "centAmount": 5000, "currencyCode": "USD", - "fractionDigits": 2, - "type": "centPrecision", }, "tiers": undefined, },