From d55b6b65b63aaee8f18b61ccbbbcba868224debd Mon Sep 17 00:00:00 2001 From: aastha Date: Wed, 18 Dec 2024 08:04:43 +0530 Subject: [PATCH 1/6] Minor --- src/app/core/services/tasks.service.spec.ts | 27 +++++++++- src/app/core/services/tasks.service.ts | 2 + .../dashboard/tasks/tasks-2.component.spec.ts | 49 ++++++++++++++++++- .../tasks/tasks.component.setup.spec.ts | 15 +++++- .../fyle/dashboard/tasks/tasks.component.ts | 15 ++++-- 5 files changed, 98 insertions(+), 10 deletions(-) diff --git a/src/app/core/services/tasks.service.spec.ts b/src/app/core/services/tasks.service.spec.ts index 8670123d2f..518f88552a 100644 --- a/src/app/core/services/tasks.service.spec.ts +++ b/src/app/core/services/tasks.service.spec.ts @@ -40,7 +40,7 @@ import { sentBackReportTaskSingularSample, verifyMobileNumberTask2, } from '../mock-data/task.data'; -import { mastercardRTFCard } from '../mock-data/platform-corporate-card.data'; +import { mastercardRTFCard, statementUploadedCard, visaRTFCard } from '../mock-data/platform-corporate-card.data'; import { OrgSettingsService } from './org-settings.service'; import { ExpensesService } from './platform/v1/spender/expenses.service'; import { expenseDuplicateSets } from '../mock-data/platform/v1/expense-duplicate-sets.data'; @@ -66,7 +66,6 @@ import { expectedSentBackResponse, expectedSentBackResponseSingularReport, } from '../mock-data/report-stats.data'; -import { expectedReportsSinglePage } from '../mock-data/platform-report.data'; import { OrgService } from './org.service'; import { orgData1 } from '../mock-data/org.data'; import { UtilityService } from './utility.service'; @@ -421,6 +420,29 @@ describe('TasksService', () => { }); }); + describe('getAddCorporateCardTask(): ', () => { + it('should return add corporate card task when no cards are enrolled', (done) => { + corporateCreditCardExpenseService.getCorporateCards.and.returnValue(of([statementUploadedCard])); + const addCcSpy = spyOn(tasksService, 'mapAddCorporateCardTask'); + + tasksService.getAddCorporateCardTask().subscribe((tasks) => { + expect(corporateCreditCardExpenseService.getCorporateCards).toHaveBeenCalled(); + expect(tasksService.mapAddCorporateCardTask).toHaveBeenCalled(); + expect(addCcSpy).toHaveBeenCalledOnceWith(); + done(); + }); + }); + + it('should return undefined when there are enrolled cards', (done) => { + corporateCreditCardExpenseService.getCorporateCards.and.returnValue(of([mastercardRTFCard, visaRTFCard])); + tasksService.getAddCorporateCardTask().subscribe((tasks) => { + expect(corporateCreditCardExpenseService.getCorporateCards).toHaveBeenCalled(); + expect(tasks).toEqual([]); + done(); + }); + }); + }); + it('should be able to fetch advancesTaskCount', (done) => { tasksService.advancesTaskCount$.next(10); tasksService @@ -780,6 +802,7 @@ describe('TasksService', () => { corporateCreditCardExpenseService.getCorporateCards.and.returnValue(of([mastercardRTFCard])); orgSettingsService.get.and.returnValue(of(orgSettingsRes)); employeesService.getCommuteDetails.and.returnValue(of(commuteDetailsResponseData)); + corporateCreditCardExpenseService.getCorporateCards.and.returnValue(of([mastercardRTFCard])); } it('should be able to fetch tasks with no filters', (done) => { diff --git a/src/app/core/services/tasks.service.ts b/src/app/core/services/tasks.service.ts index db75d7ebf4..2f17095311 100644 --- a/src/app/core/services/tasks.service.ts +++ b/src/app/core/services/tasks.service.ts @@ -537,6 +537,8 @@ export class TasksService { const rtfCards = cards.filter((card) => card.is_visa_enrolled || card.is_mastercard_enrolled); if (rtfCards.length === 0) { return this.mapAddCorporateCardTask(); + } else { + return [] as DashboardTask[]; } }) ); diff --git a/src/app/fyle/dashboard/tasks/tasks-2.component.spec.ts b/src/app/fyle/dashboard/tasks/tasks-2.component.spec.ts index 24b14558fa..27b314afc5 100644 --- a/src/app/fyle/dashboard/tasks/tasks-2.component.spec.ts +++ b/src/app/fyle/dashboard/tasks/tasks-2.component.spec.ts @@ -1,5 +1,5 @@ import { ComponentFixture, fakeAsync, tick, waitForAsync } from '@angular/core/testing'; -import { ModalController } from '@ionic/angular'; +import { ModalController, PopoverController } from '@ionic/angular'; import { TasksComponent } from './tasks.component'; import { TasksService } from 'src/app/core/services/tasks.service'; @@ -48,6 +48,19 @@ import { apiEouRes } from 'src/app/core/mock-data/extended-org-user.data'; import { OrgService } from 'src/app/core/services/org.service'; import { orgData1 } from 'src/app/core/mock-data/org.data'; import { FyOptInComponent } from 'src/app/shared/components/fy-opt-in/fy-opt-in.component'; +import { Component, Input } from '@angular/core'; +import { AddCorporateCardComponent } from '../../manage-corporate-cards/add-corporate-card/add-corporate-card.component'; +import { By } from '@angular/platform-browser'; +import { OrgUserSettingsService } from 'src/app/core/services/org-user-settings.service'; +import { CorporateCreditCardExpenseService } from 'src/app/core/services/corporate-credit-card-expense.service'; + +@Component({ + selector: 'app-add-card', + template: '
', +}) +class MockAddCardComponent { + @Input() showZeroStateMessage: boolean; +} export function TestCases2(getTestBed) { return describe('test case set 2', () => { @@ -71,6 +84,9 @@ export function TestCases2(getTestBed) { let spenderReportsService: jasmine.SpyObj; let approverReportsService: jasmine.SpyObj; let orgService: jasmine.SpyObj; + let popoverController: jasmine.SpyObj; + let orgUserSettingsService: jasmine.SpyObj; + let corporateCreditCardExpenseService: jasmine.SpyObj; beforeEach(waitForAsync(() => { const TestBed = getTestBed(); @@ -94,6 +110,13 @@ export function TestCases2(getTestBed) { spenderReportsService = TestBed.inject(SpenderReportsService) as jasmine.SpyObj; approverReportsService = TestBed.inject(ApproverReportsService) as jasmine.SpyObj; orgService = TestBed.inject(OrgService) as jasmine.SpyObj; + popoverController = TestBed.inject(PopoverController) as jasmine.SpyObj; + orgUserSettingsService = TestBed.inject(OrgUserSettingsService) as jasmine.SpyObj; + corporateCreditCardExpenseService = TestBed.inject( + CorporateCreditCardExpenseService + ) as jasmine.SpyObj; + let addCardPopoverSpy: jasmine.SpyObj; + popoverController.create.and.returnValues(Promise.resolve(addCardPopoverSpy)); })); describe('init():', () => { @@ -182,6 +205,30 @@ export function TestCases2(getTestBed) { }); }); + it('onAddCorporateCardClick(): should open card popover', fakeAsync(() => { + let addCardPopoverSpy: jasmine.SpyObj; + addCardPopoverSpy = jasmine.createSpyObj('HTMLIonPopoverElement', ['present', 'onDidDismiss']); + // Returning empty object, because we don't want to trigger the success flow, we are just testing if the popover opens or not + addCardPopoverSpy.onDidDismiss.and.resolveTo({}); + + const addCardComponent = fixture.debugElement.query(By.directive(MockAddCardComponent)); + addCardComponent.triggerEventHandler('addCardClick', null); + + tick(); + + expect(popoverController.create).toHaveBeenCalledOnceWith({ + component: AddCorporateCardComponent, + cssClass: 'fy-dialog-popover', + componentProps: { + isVisaRTFEnabled: true, + isMastercardRTFEnabled: true, + isYodleeEnabled: true, + }, + }); + + expect(addCardPopoverSpy.present).toHaveBeenCalledTimes(1); + })); + it('onMobileNumberVerificationTaskClick(): should open opt in modal', fakeAsync(() => { authService.getEou.and.resolveTo(apiEouRes); const optInModalSpy = jasmine.createSpyObj('optInModal', ['present', 'onWillDismiss']); diff --git a/src/app/fyle/dashboard/tasks/tasks.component.setup.spec.ts b/src/app/fyle/dashboard/tasks/tasks.component.setup.spec.ts index 96b05289b1..80c010ec6a 100644 --- a/src/app/fyle/dashboard/tasks/tasks.component.setup.spec.ts +++ b/src/app/fyle/dashboard/tasks/tasks.component.setup.spec.ts @@ -1,5 +1,5 @@ import { TestBed } from '@angular/core/testing'; -import { IonicModule, ModalController } from '@ionic/angular'; +import { IonicModule, ModalController, PopoverController } from '@ionic/angular'; import { TasksComponent } from './tasks.component'; import { TasksService } from 'src/app/core/services/tasks.service'; @@ -24,8 +24,10 @@ import { OrgSettingsService } from 'src/app/core/services/org-settings.service'; import { SpenderReportsService } from 'src/app/core/services/platform/v1/spender/reports.service'; import { ApproverReportsService } from 'src/app/core/services/platform/v1/approver/reports.service'; import { OrgService } from 'src/app/core/services/org.service'; +import { OrgUserSettingsService } from 'src/app/core/services/org-user-settings.service'; +import { CorporateCreditCardExpenseService } from 'src/app/core/services/corporate-credit-card-expense.service'; -describe('TasksComponent', () => { +fdescribe('TasksComponent', () => { const getTestBed = () => { const tasksServiceSpy = jasmine.createSpyObj('TasksService', [ 'getTasks', @@ -65,6 +67,10 @@ describe('TasksComponent', () => { 'getAllReportsByParams', ]); const approverReportsServiceSpy = jasmine.createSpyObj('ApproverReportsService', ['getAllReportsByParams']); + const orgUserSettingsServiceSpy = jasmine.createSpyObj('OrgUserSettingsService', ['get']); + const corporateCreditCardExpenseServiceSpy = jasmine.createSpyObj('CorporateCreditCardExpenseService', [ + 'getCorporateCards', + ]); const matSnackBarSpy = jasmine.createSpyObj('MatSnackBar', ['openFromComponent']); const snackbarPropertiesSpy = jasmine.createSpyObj('SnackbarPropertiesService', ['setSnackbarProperties']); const orgServiceSpy = jasmine.createSpyObj('OrgService', ['getPrimaryOrg', 'getCurrentOrg']); @@ -77,8 +83,10 @@ describe('TasksComponent', () => { }, }, }; + const popoverControllerSpy = jasmine.createSpyObj('PopoverController', ['create', 'onDidDismiss']); const networkServiceSpy = jasmine.createSpyObj('NetworkService', ['connectivityWatcher', 'isOnline']); + const addCardPopoverSpy = jasmine.createSpyObj('HTMLIonPopoverElement', ['present', 'onDidDismiss']); TestBed.configureTestingModule({ declarations: [TasksComponent], imports: [IonicModule.forRoot(), RouterTestingModule], @@ -102,6 +110,9 @@ describe('TasksComponent', () => { { provide: SpenderReportsService, useValue: spenderReportsServiceSpy }, { provide: ApproverReportsService, useValue: approverReportsServiceSpy }, { provide: OrgService, useValue: orgServiceSpy }, + { provide: PopoverController, useValue: popoverControllerSpy }, + { provide: OrgUserSettingsService, useValue: orgUserSettingsServiceSpy }, + { provide: CorporateCreditCardExpenseService, useValue: corporateCreditCardExpenseServiceSpy }, ], schemas: [NO_ERRORS_SCHEMA], }).compileComponents(); diff --git a/src/app/fyle/dashboard/tasks/tasks.component.ts b/src/app/fyle/dashboard/tasks/tasks.component.ts index a38cd6b73a..dc780b3524 100644 --- a/src/app/fyle/dashboard/tasks/tasks.component.ts +++ b/src/app/fyle/dashboard/tasks/tasks.component.ts @@ -400,11 +400,8 @@ export class TasksComponent implements OnInit { }); } - onTaskClicked(taskCta: TaskCta, task: DashboardTask): void { - this.trackingService.tasksClicked({ - Asset: 'Mobile', - header: task.header, - }); + // eslint-disable-next-line complexity + loadTasksMap(taskCta: TaskCta, task: DashboardTask): void { switch (taskCta.event) { case TASKEVENT.expensesAddToReport: this.onExpensesToReportTaskClick(); @@ -441,6 +438,14 @@ export class TasksComponent implements OnInit { } } + onTaskClicked(taskCta: TaskCta, task: DashboardTask): void { + this.trackingService.tasksClicked({ + Asset: 'Mobile', + header: task.header, + }); + this.loadTasksMap(taskCta, task); + } + onMobileNumberVerificationTaskClick(): void { this.trackingService.clickedOnTask({ type: 'Opt in', From 492075922f877196df7411e1f12364f646e67b28 Mon Sep 17 00:00:00 2001 From: aastha Date: Wed, 18 Dec 2024 10:25:36 +0530 Subject: [PATCH 2/6] Minor --- src/app/fyle/dashboard/tasks/tasks-1.component.spec.ts | 8 ++++++++ src/app/fyle/dashboard/tasks/tasks-2.component.spec.ts | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/src/app/fyle/dashboard/tasks/tasks-1.component.spec.ts b/src/app/fyle/dashboard/tasks/tasks-1.component.spec.ts index 2a46d98304..3b4fe5e605 100644 --- a/src/app/fyle/dashboard/tasks/tasks-1.component.spec.ts +++ b/src/app/fyle/dashboard/tasks/tasks-1.component.spec.ts @@ -41,6 +41,8 @@ import { taskCtaData8, taskCtaData9, } from 'src/app/core/mock-data/task-cta.data'; +import { OrgSettingsService } from 'src/app/core/services/org-settings.service'; +import { orgSettingsPendingRestrictions } from 'src/app/core/mock-data/org-settings.data'; export function TestCases1(getTestBed) { return describe('test case set 1', () => { @@ -60,6 +62,7 @@ export function TestCases1(getTestBed) { let router: jasmine.SpyObj; let activatedRoute: jasmine.SpyObj; let networkService: jasmine.SpyObj; + let orgSettingsService: jasmine.SpyObj; beforeEach(waitForAsync(() => { const TestBed = getTestBed(); @@ -79,6 +82,7 @@ export function TestCases1(getTestBed) { router = TestBed.inject(Router) as jasmine.SpyObj; activatedRoute = TestBed.inject(ActivatedRoute) as jasmine.SpyObj; networkService = TestBed.inject(NetworkService) as jasmine.SpyObj; + orgSettingsService = TestBed.inject(OrgSettingsService) as jasmine.SpyObj; })); it('should create', () => { @@ -86,6 +90,10 @@ export function TestCases1(getTestBed) { }); it('ngOnInit(): should call setupNetworkWatcher once', () => { + orgSettingsService.get.and.returnValue(of(orgSettingsPendingRestrictions)); + component.isVisaRTFEnabled$ = of(true); + component.isMastercardRTFEnabled$ = of(true); + component.isYodleeEnabled$ = of(true); spyOn(component, 'setupNetworkWatcher'); fixture.detectChanges(); diff --git a/src/app/fyle/dashboard/tasks/tasks-2.component.spec.ts b/src/app/fyle/dashboard/tasks/tasks-2.component.spec.ts index 27b314afc5..ca87222775 100644 --- a/src/app/fyle/dashboard/tasks/tasks-2.component.spec.ts +++ b/src/app/fyle/dashboard/tasks/tasks-2.component.spec.ts @@ -53,6 +53,7 @@ import { AddCorporateCardComponent } from '../../manage-corporate-cards/add-corp import { By } from '@angular/platform-browser'; import { OrgUserSettingsService } from 'src/app/core/services/org-user-settings.service'; import { CorporateCreditCardExpenseService } from 'src/app/core/services/corporate-credit-card-expense.service'; +import { OrgSettingsService } from 'src/app/core/services/org-settings.service'; @Component({ selector: 'app-add-card', @@ -87,6 +88,7 @@ export function TestCases2(getTestBed) { let popoverController: jasmine.SpyObj; let orgUserSettingsService: jasmine.SpyObj; let corporateCreditCardExpenseService: jasmine.SpyObj; + let orgSettingsService: jasmine.SpyObj; beforeEach(waitForAsync(() => { const TestBed = getTestBed(); @@ -117,6 +119,7 @@ export function TestCases2(getTestBed) { ) as jasmine.SpyObj; let addCardPopoverSpy: jasmine.SpyObj; popoverController.create.and.returnValues(Promise.resolve(addCardPopoverSpy)); + orgSettingsService = TestBed.inject(OrgSettingsService) as jasmine.SpyObj; })); describe('init():', () => { @@ -207,6 +210,7 @@ export function TestCases2(getTestBed) { it('onAddCorporateCardClick(): should open card popover', fakeAsync(() => { let addCardPopoverSpy: jasmine.SpyObj; + // eslint-disable-next-line prefer-const addCardPopoverSpy = jasmine.createSpyObj('HTMLIonPopoverElement', ['present', 'onDidDismiss']); // Returning empty object, because we don't want to trigger the success flow, we are just testing if the popover opens or not addCardPopoverSpy.onDidDismiss.and.resolveTo({}); From df6dc317c2734250f7dfb6c02038e75a8e95756b Mon Sep 17 00:00:00 2001 From: aastha Date: Wed, 18 Dec 2024 11:19:46 +0530 Subject: [PATCH 3/6] Minor --- .../card-stats/card-stats.component.spec.ts | 1 - .../dashboard/tasks/tasks-2.component.spec.ts | 26 +++++++++---------- .../tasks/tasks.component.setup.spec.ts | 2 +- 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/src/app/fyle/dashboard/card-stats/card-stats.component.spec.ts b/src/app/fyle/dashboard/card-stats/card-stats.component.spec.ts index 37bf257a29..9fac829fb1 100644 --- a/src/app/fyle/dashboard/card-stats/card-stats.component.spec.ts +++ b/src/app/fyle/dashboard/card-stats/card-stats.component.spec.ts @@ -342,7 +342,6 @@ xdescribe('CardStatsComponent', () => { it('should open the add corporate card modal on addCardClick event', fakeAsync(() => { // Returning empty object, because we don't want to trigger the success flow, we are just testing if the popover opens or not - addCardPopoverSpy.onDidDismiss.and.resolveTo({}); component.isVirtualCardsEnabled$ = of({ enabled: false }); fixture.detectChanges(); diff --git a/src/app/fyle/dashboard/tasks/tasks-2.component.spec.ts b/src/app/fyle/dashboard/tasks/tasks-2.component.spec.ts index ca87222775..5d9b781bfb 100644 --- a/src/app/fyle/dashboard/tasks/tasks-2.component.spec.ts +++ b/src/app/fyle/dashboard/tasks/tasks-2.component.spec.ts @@ -55,14 +55,6 @@ import { OrgUserSettingsService } from 'src/app/core/services/org-user-settings. import { CorporateCreditCardExpenseService } from 'src/app/core/services/corporate-credit-card-expense.service'; import { OrgSettingsService } from 'src/app/core/services/org-settings.service'; -@Component({ - selector: 'app-add-card', - template: '
', -}) -class MockAddCardComponent { - @Input() showZeroStateMessage: boolean; -} - export function TestCases2(getTestBed) { return describe('test case set 2', () => { let component: TasksComponent; @@ -209,17 +201,23 @@ export function TestCases2(getTestBed) { }); it('onAddCorporateCardClick(): should open card popover', fakeAsync(() => { - let addCardPopoverSpy: jasmine.SpyObj; - // eslint-disable-next-line prefer-const - addCardPopoverSpy = jasmine.createSpyObj('HTMLIonPopoverElement', ['present', 'onDidDismiss']); - // Returning empty object, because we don't want to trigger the success flow, we are just testing if the popover opens or not + // Mock the observables + component.isVisaRTFEnabled$ = of(true); + component.isMastercardRTFEnabled$ = of(true); + component.isYodleeEnabled$ = of(true); + + // Mock the PopoverController + const addCardPopoverSpy = jasmine.createSpyObj('HTMLIonPopoverElement', ['present', 'onDidDismiss']); + addCardPopoverSpy.present.and.resolveTo(); addCardPopoverSpy.onDidDismiss.and.resolveTo({}); - const addCardComponent = fixture.debugElement.query(By.directive(MockAddCardComponent)); - addCardComponent.triggerEventHandler('addCardClick', null); + popoverController.create.and.resolveTo(addCardPopoverSpy); + // Call the method + component.onAddCorporateCardClick(); tick(); + // Assert popover creation expect(popoverController.create).toHaveBeenCalledOnceWith({ component: AddCorporateCardComponent, cssClass: 'fy-dialog-popover', diff --git a/src/app/fyle/dashboard/tasks/tasks.component.setup.spec.ts b/src/app/fyle/dashboard/tasks/tasks.component.setup.spec.ts index 80c010ec6a..548a9a02c7 100644 --- a/src/app/fyle/dashboard/tasks/tasks.component.setup.spec.ts +++ b/src/app/fyle/dashboard/tasks/tasks.component.setup.spec.ts @@ -27,7 +27,7 @@ import { OrgService } from 'src/app/core/services/org.service'; import { OrgUserSettingsService } from 'src/app/core/services/org-user-settings.service'; import { CorporateCreditCardExpenseService } from 'src/app/core/services/corporate-credit-card-expense.service'; -fdescribe('TasksComponent', () => { +describe('TasksComponent', () => { const getTestBed = () => { const tasksServiceSpy = jasmine.createSpyObj('TasksService', [ 'getTasks', From ffe935ece28f5b01abd2c2f0f85f121001fb8a33 Mon Sep 17 00:00:00 2001 From: aastha Date: Wed, 18 Dec 2024 11:37:00 +0530 Subject: [PATCH 4/6] Minor --- src/app/core/services/tasks.service.spec.ts | 1 + src/app/core/services/tasks.service.ts | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/app/core/services/tasks.service.spec.ts b/src/app/core/services/tasks.service.spec.ts index 518f88552a..aa744cb117 100644 --- a/src/app/core/services/tasks.service.spec.ts +++ b/src/app/core/services/tasks.service.spec.ts @@ -422,6 +422,7 @@ describe('TasksService', () => { describe('getAddCorporateCardTask(): ', () => { it('should return add corporate card task when no cards are enrolled', (done) => { + orgSettingsService.get.and.returnValue(of(orgSettingsRes)); corporateCreditCardExpenseService.getCorporateCards.and.returnValue(of([statementUploadedCard])); const addCcSpy = spyOn(tasksService, 'mapAddCorporateCardTask'); diff --git a/src/app/core/services/tasks.service.ts b/src/app/core/services/tasks.service.ts index 2f17095311..abe31f437c 100644 --- a/src/app/core/services/tasks.service.ts +++ b/src/app/core/services/tasks.service.ts @@ -532,10 +532,15 @@ export class TasksService { } getAddCorporateCardTask(): Observable { - return this.corporateCreditCardExpenseService.getCorporateCards().pipe( - map((cards) => { + return forkJoin([this.orgSettingsService.get(), this.corporateCreditCardExpenseService.getCorporateCards()]).pipe( + map(([orgSettings, cards]) => { + const isRtfEnabled = + (orgSettings.visa_enrollment_settings.allowed && orgSettings.visa_enrollment_settings.enabled) || + (orgSettings.mastercard_enrollment_settings.allowed && orgSettings.mastercard_enrollment_settings.enabled); + const isCCCEnabled = + orgSettings.corporate_credit_card_settings.allowed && orgSettings.corporate_credit_card_settings.enabled; const rtfCards = cards.filter((card) => card.is_visa_enrolled || card.is_mastercard_enrolled); - if (rtfCards.length === 0) { + if (isRtfEnabled && isCCCEnabled && rtfCards.length === 0) { return this.mapAddCorporateCardTask(); } else { return [] as DashboardTask[]; From f63791a07d04aa0950c5c544ed6fbfd692300f9b Mon Sep 17 00:00:00 2001 From: Aastha Bist Date: Thu, 19 Dec 2024 13:05:28 +0530 Subject: [PATCH 5/6] Update card-stats.component.spec.ts --- src/app/fyle/dashboard/card-stats/card-stats.component.spec.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/app/fyle/dashboard/card-stats/card-stats.component.spec.ts b/src/app/fyle/dashboard/card-stats/card-stats.component.spec.ts index 9fac829fb1..2d8a2579b1 100644 --- a/src/app/fyle/dashboard/card-stats/card-stats.component.spec.ts +++ b/src/app/fyle/dashboard/card-stats/card-stats.component.spec.ts @@ -341,6 +341,7 @@ xdescribe('CardStatsComponent', () => { }); it('should open the add corporate card modal on addCardClick event', fakeAsync(() => { + addCardPopoverSpy.onDidDismiss.and.resolveTo({}); // Returning empty object, because we don't want to trigger the success flow, we are just testing if the popover opens or not component.isVirtualCardsEnabled$ = of({ enabled: false }); fixture.detectChanges(); From 8787ab310ea844fde48bce128413397aad7554f5 Mon Sep 17 00:00:00 2001 From: Aastha Bist Date: Thu, 19 Dec 2024 13:05:59 +0530 Subject: [PATCH 6/6] Update card-stats.component.spec.ts --- src/app/fyle/dashboard/card-stats/card-stats.component.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/fyle/dashboard/card-stats/card-stats.component.spec.ts b/src/app/fyle/dashboard/card-stats/card-stats.component.spec.ts index 2d8a2579b1..37bf257a29 100644 --- a/src/app/fyle/dashboard/card-stats/card-stats.component.spec.ts +++ b/src/app/fyle/dashboard/card-stats/card-stats.component.spec.ts @@ -341,8 +341,8 @@ xdescribe('CardStatsComponent', () => { }); it('should open the add corporate card modal on addCardClick event', fakeAsync(() => { - addCardPopoverSpy.onDidDismiss.and.resolveTo({}); // Returning empty object, because we don't want to trigger the success flow, we are just testing if the popover opens or not + addCardPopoverSpy.onDidDismiss.and.resolveTo({}); component.isVirtualCardsEnabled$ = of({ enabled: false }); fixture.detectChanges();