From 7a5ffd880cbd6e7f07ed3d54ff19878f2d8cbf10 Mon Sep 17 00:00:00 2001 From: Uros Lates Date: Fri, 18 Oct 2024 09:38:35 +0200 Subject: [PATCH] fix: address PR comments related to tests - fix linting errors. --- ...heckout-delivery-address.component.spec.ts | 42 +++++++++-------- .../checkout-payment-method.component.spec.ts | 46 ++++++++++--------- 2 files changed, 48 insertions(+), 40 deletions(-) diff --git a/feature-libs/checkout/base/components/checkout-delivery-address/checkout-delivery-address.component.spec.ts b/feature-libs/checkout/base/components/checkout-delivery-address/checkout-delivery-address.component.spec.ts index 99ffb4becbd..abc6fb649a4 100644 --- a/feature-libs/checkout/base/components/checkout-delivery-address/checkout-delivery-address.component.spec.ts +++ b/feature-libs/checkout/base/components/checkout-delivery-address/checkout-delivery-address.component.spec.ts @@ -346,34 +346,38 @@ describe('CheckoutDeliveryAddressComponent', () => { ); expect(card.actions?.length).toBe(1); }); - + describe('role', () => { beforeEach(() => { spyOn(featureConfig, 'isEnabled').and.returnValue(true); }); it('should be set to "region" for selected address', () => { - expect(component.getCardContent( - mockAddress1, - mockAddress1, - 'default', - 'shipTo', - 'selected', - 'P', - 'M' - ).role).toEqual('region'); + expect( + component.getCardContent( + mockAddress1, + mockAddress1, + 'default', + 'shipTo', + 'selected', + 'P', + 'M' + ).role + ).toEqual('region'); expect(component['getCardRole']).toHaveBeenCalledWith(true); }); it('should be set to "button" for all non selected addresses', () => { - expect(component.getCardContent( - mockAddress1, - mockAddress2, - 'default', - 'shipTo', - 'selected', - 'P', - 'M' - ).role).toEqual('button'); + expect( + component.getCardContent( + mockAddress1, + mockAddress2, + 'default', + 'shipTo', + 'selected', + 'P', + 'M' + ).role + ).toEqual('button'); expect(component['getCardRole']).toHaveBeenCalledWith(false); }); }); diff --git a/feature-libs/checkout/base/components/checkout-payment-method/checkout-payment-method.component.spec.ts b/feature-libs/checkout/base/components/checkout-payment-method/checkout-payment-method.component.spec.ts index 05ac77a1529..ae49b1db0fb 100644 --- a/feature-libs/checkout/base/components/checkout-payment-method/checkout-payment-method.component.spec.ts +++ b/feature-libs/checkout/base/components/checkout-payment-method/checkout-payment-method.component.spec.ts @@ -622,7 +622,7 @@ describe('CheckoutPaymentMethodComponent', () => { let paymentMethod1: PaymentDetails; beforeEach(() => { spyOn(featureConfig, 'isEnabled').and.returnValue(true); - paymentMethod1= { + paymentMethod1 = { id: 'selected payment method', accountHolderName: 'Name', cardNumber: '123456789', @@ -638,29 +638,33 @@ describe('CheckoutPaymentMethodComponent', () => { }); it('should be set to "region" for selected payment card', () => { - expect(component['createCard']( - paymentMethod1, - { - textDefaultPaymentMethod: '✓ DEFAULT', - textExpires: 'Expires', - textUseThisPayment: 'Use this payment', - textSelected: 'Selected', - }, - paymentMethod1 - ).role).toEqual('region'); + expect( + component['createCard']( + paymentMethod1, + { + textDefaultPaymentMethod: '✓ DEFAULT', + textExpires: 'Expires', + textUseThisPayment: 'Use this payment', + textSelected: 'Selected', + }, + paymentMethod1 + ).role + ).toEqual('region'); }); it('should be set to "button" for non selected payment cards', () => { - expect(component['createCard']( - paymentMethod1, - { - textDefaultPaymentMethod: '✓ DEFAULT', - textExpires: 'Expires', - textUseThisPayment: 'Use this payment', - textSelected: 'Selected', - }, - {...paymentMethod1, id: 'newId'} - ).role).toEqual('button'); + expect( + component['createCard']( + paymentMethod1, + { + textDefaultPaymentMethod: '✓ DEFAULT', + textExpires: 'Expires', + textUseThisPayment: 'Use this payment', + textSelected: 'Selected', + }, + { ...paymentMethod1, id: 'newId' } + ).role + ).toEqual('button'); }); }); });