Skip to content

Commit

Permalink
fixup! refactor: extend the ExternalDisplayPropertiesProvider to get …
Browse files Browse the repository at this point in the history
…not only the product from the product context but the prices too (#1657)
  • Loading branch information
shauke committed May 16, 2024
1 parent 562e7f4 commit 6640158
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/app/core/facades/product-context.facade.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { AttributeGroup } from 'ish-core/models/attribute-group/attribute-group.
import { AttributeGroupTypes } from 'ish-core/models/attribute-group/attribute-group.types';
import { CategoryView } from 'ish-core/models/category-view/category-view.model';
import { Category } from 'ish-core/models/category/category.model';
import { PriceHelper } from 'ish-core/models/price/price.helper';
import { ProductView } from 'ish-core/models/product-view/product-view.model';
import { ProductCompletenessLevel } from 'ish-core/models/product/product.model';

Expand Down Expand Up @@ -326,6 +327,7 @@ describe('Product Context Facade', () => {

describe('display properties', () => {
it('should set correct display properties for product', () => {
context.set('prices', () => ({ salePrice: PriceHelper.empty() }));
expect(context.get('displayProperties')).toMatchInlineSnapshot(`
{
"addToBasket": true,
Expand All @@ -351,6 +353,7 @@ describe('Product Context Facade', () => {
});

it('should include external displayProperty overrides when calculating', () => {
context.set('prices', () => ({ salePrice: PriceHelper.empty() }));
context.config = {
readOnly: true,
name: false,
Expand Down Expand Up @@ -576,6 +579,7 @@ describe('Product Context Facade', () => {
{ sku: 'p2', quantity: 2 },
])
);
context.set('prices', () => ({ salePrice: PriceHelper.empty() }));
context.set('sku', () => '123');
});

Expand Down Expand Up @@ -639,6 +643,7 @@ describe('Product Context Facade', () => {
} as ProductView;
when(shoppingFacade.product$(anything(), anything())).thenReturn(of(product));

context.set('prices', () => ({ salePrice: PriceHelper.empty() }));
context.set('sku', () => '123');
});

Expand Down Expand Up @@ -802,6 +807,7 @@ describe('Product Context Facade', () => {
});

it('should set correct display properties respecting overrides from providers for product 123', () => {
context.set('prices', () => ({ salePrice: PriceHelper.empty() }));
context.set('sku', () => '123');

expect(context.get('displayProperties')).toMatchInlineSnapshot(`
Expand Down

0 comments on commit 6640158

Please sign in to comment.