Skip to content

Commit

Permalink
fix: address PR comments related to tests - fix linting errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
ulates-sap committed Oct 18, 2024
1 parent d77acbd commit 7a5ffd8
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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');
});
});
});
Expand Down

0 comments on commit 7a5ffd8

Please sign in to comment.