Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(test-data): use Money over CentPrecisionMoney in shipping rate drafts #388

Merged
merged 1 commit into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/hip-seals-sell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@commercetools-test-data/shipping-method': patch
---

Use Money over CentPrecisionMoney in Good Store shipping rate drafts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ describe('Shipping Method with express preset', () => {
"price": {
"centAmount": 50000,
"currencyCode": "EUR",
"fractionDigits": 2,
"type": "centPrecision",
},
"tiers": [],
},
Expand All @@ -36,8 +34,6 @@ describe('Shipping Method with express preset', () => {
"price": {
"centAmount": 50000,
"currencyCode": "GBP",
"fractionDigits": 2,
"type": "centPrecision",
},
"tiers": [],
},
Expand Down Expand Up @@ -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": [],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ describe('Shipping Method with standard preset', () => {
"price": {
"centAmount": 10000,
"currencyCode": "EUR",
"fractionDigits": 2,
"type": "centPrecision",
},
"tiers": [],
},
Expand All @@ -36,8 +34,6 @@ describe('Shipping Method with standard preset', () => {
"price": {
"centAmount": 10000,
"currencyCode": "GBP",
"fractionDigits": 2,
"type": "centPrecision",
},
"tiers": [],
},
Expand All @@ -54,8 +50,6 @@ describe('Shipping Method with standard preset', () => {
"price": {
"centAmount": 10000,
"currencyCode": "GBP",
"fractionDigits": 2,
"type": "centPrecision",
},
"tiers": [],
},
Expand All @@ -64,8 +58,6 @@ describe('Shipping Method with standard preset', () => {
"price": {
"centAmount": 10000,
"currencyCode": "EUR",
"fractionDigits": 2,
"type": "centPrecision",
},
"tiers": [],
},
Expand Down Expand Up @@ -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": [],
},
Expand All @@ -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": [],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand Down Expand Up @@ -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,
},
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Original file line number Diff line number Diff line change
@@ -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;
Original file line number Diff line number Diff line change
@@ -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;
Original file line number Diff line number Diff line change
@@ -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;
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand All @@ -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,
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ describe('with europeExpress preset', () => {
"price": {
"centAmount": 50000,
"currencyCode": "EUR",
"fractionDigits": 2,
"type": "centPrecision",
},
"tiers": [],
},
Expand All @@ -22,8 +20,6 @@ describe('with europeExpress preset', () => {
"price": {
"centAmount": 50000,
"currencyCode": "GBP",
"fractionDigits": 2,
"type": "centPrecision",
},
"tiers": [],
},
Expand All @@ -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": [],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ describe('with europe preset', () => {
"price": {
"centAmount": 10000,
"currencyCode": "EUR",
"fractionDigits": 2,
"type": "centPrecision",
},
"tiers": [],
},
Expand All @@ -22,8 +20,6 @@ describe('with europe preset', () => {
"price": {
"centAmount": 10000,
"currencyCode": "GBP",
"fractionDigits": 2,
"type": "centPrecision",
},
"tiers": [],
},
Expand All @@ -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": [],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ describe('with unitedKingdom preset', () => {
"price": {
"centAmount": 10000,
"currencyCode": "GBP",
"fractionDigits": 2,
"type": "centPrecision",
},
"tiers": [],
},
Expand All @@ -22,8 +20,6 @@ describe('with unitedKingdom preset', () => {
"price": {
"centAmount": 10000,
"currencyCode": "EUR",
"fractionDigits": 2,
"type": "centPrecision",
},
"tiers": [],
},
Expand All @@ -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": [],
},
Expand Down
Loading