Skip to content

Commit

Permalink
Minor
Browse files Browse the repository at this point in the history
  • Loading branch information
bistaastha committed Jan 20, 2025
1 parent b60588a commit 72b992c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/app/core/mock-data/modal-controller.data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ export const enrollmentErrorPopoverData1 = {
action: 'cancel',
},
cardsList: {},
leftAlign: true,
},
component: PopupAlertComponent,
cssClass: 'pop-up-in-center',
Expand All @@ -123,6 +124,7 @@ export const enrollmentErrorPopoverData2 = {
successfulCards: ['**** 1111'],
failedCards: ['**** 1111'],
},
leftAlign: true,
},
component: PopupAlertComponent,
cssClass: 'pop-up-in-center',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ describe('SpenderOnboardingConnectCardStepComponent', () => {
expect(component.cardsEnrolling).toBeTrue();
});

it('should call enrollMultipleCards if enrollableCards has items', () => {
it('should call enrollMultipleCards if enrollableCards has items - case when there are no items', () => {
const enrollSingularCardSpy = spyOn(component, 'enrollSingularCard');
const enrollMultipleCardsSpy = spyOn(component, 'enrollMultipleCards');
component.ngOnInit();
Expand All @@ -214,9 +214,9 @@ describe('SpenderOnboardingConnectCardStepComponent', () => {

component.enrollCards();

expect(enrollMultipleCardsSpy).toHaveBeenCalledWith([component.enrollableCards[1]]);
expect(enrollMultipleCardsSpy).not.toHaveBeenCalled();
expect(enrollSingularCardSpy).not.toHaveBeenCalled();
expect(component.cardsEnrolling).toBeTrue();
expect(component.cardsEnrolling).toBeFalse();
});

it('should call enrollSingularCard if enrollableCards is empty', () => {
Expand Down Expand Up @@ -364,6 +364,10 @@ describe('SpenderOnboardingConnectCardStepComponent', () => {
});

it('should display a popover when successful cards are present and handle its actions', fakeAsync(() => {
component.cardsList = {
successfulCards: ['**** 1111'],
failedCards: ['**** 1111'],
};
const popoverSpy = jasmine.createSpyObj('popover', ['present', 'onWillDismiss']);
spyOn(component, 'generateMessage').and.returnValue('Error message');
const isStepSkippedSpy = spyOn(component.isStepSkipped, 'emit');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ export class SpenderOnboardingConnectCardStepComponent implements OnInit, OnChan
} else if (this.cardsList.failedCards.length > 1) {
const allButLast = this.cardsList.failedCards.slice(0, -1).join(', ');
const lastCard = this.cardsList.failedCards[this.cardsList.failedCards.length - 1];
return `We ran into an issue while processing your request for the cards ${allButLast}} and ${lastCard}.<br><br>You can cancel and retry connecting the failed card or proceed to the next step.`;
return `We ran into an issue while processing your request for the cards ${allButLast} and ${lastCard}.<br><br>You can cancel and retry connecting the failed card or proceed to the next step.`;
} else {
return `We ran into an issue while processing your request for the card ${this.cardsList.failedCards[0]}.<br><br> You can cancel and retry connecting the failed card or proceed to the next step.`;
}
Expand Down

0 comments on commit 72b992c

Please sign in to comment.