Skip to content

Commit

Permalink
fix(common): fix discounted-line-item-portion model
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlosCortizasCT committed Dec 9, 2024
1 parent 46902ab commit 2d92053
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 18 deletions.
1 change: 0 additions & 1 deletion models/commons/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"dependencies": {
"@babel/runtime": "^7.17.9",
"@babel/runtime-corejs3": "^7.17.9",
"@commercetools-test-data/cart-discount": "10.10.1",
"@commercetools-test-data/core": "10.10.1",
"@commercetools-test-data/graphql-types": "10.10.1",
"@commercetools-test-data/product-discount": "10.10.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ describe('DiscountedLineItemPortion Builder', () => {

expect(graphqlModel).toEqual(
expect.objectContaining({
discount: expect.objectContaining({
__typename: 'CartDiscount',
}),
discount: null,
discountRef: expect.objectContaining({
id: expect.any(String),
typeId: 'cart-discount',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { CartDiscount } from '@commercetools-test-data/cart-discount';
// import { CartDiscount } from '@commercetools-test-data/cart-discount';
import { fake, type TModelFieldsConfig } from '@commercetools-test-data/core';
import { Money, Reference, TReferenceGraphql } from '../index';
import type {
Expand All @@ -22,8 +22,8 @@ export const graphqlFieldsConfig: TModelFieldsConfig<TDiscountedLineItemPortionG
{
fields: {
...commonFieldsConfig,
discount: fake(() => CartDiscount.random()),
discountRef: null,
discount: null,
discountRef: fake(() => Reference.presets.cartDiscountReference()),
__typename: 'DiscountedLineItemPortion',
},
postBuild: (model) => {
Expand All @@ -33,7 +33,7 @@ export const graphqlFieldsConfig: TModelFieldsConfig<TDiscountedLineItemPortionG
.cartDiscountReference()
.id(model.discount.id)
.buildGraphql<TReferenceGraphql<'cart-discount'>>()
: undefined,
: model.discountRef,
};
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,14 @@ describe('DiscountedLineItemPrice Builder', () => {
expect(graphqlModel).toEqual(
expect.objectContaining({
value: expect.objectContaining({
centAmount: expect.any(Number),
currencyCode: expect.any(String),
__typename: 'Money',
}),
includedDiscounts: expect.arrayContaining([
expect.objectContaining({
discountedAmount: expect.objectContaining({
centAmount: expect.any(Number),
currencyCode: expect.any(String),
__typename: 'Money',
}),
discount: expect.objectContaining({
__typename: 'CartDiscount',
}),
discount: null,
discountRef: expect.objectContaining({
typeId: 'cart-discount',
__typename: 'Reference',
Expand Down
3 changes: 0 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2d92053

Please sign in to comment.