From 68d86ac9e96e70860835bf414f179709a191364f Mon Sep 17 00:00:00 2001 From: suyashpatil78 Date: Thu, 12 Oct 2023 14:10:25 +0530 Subject: [PATCH] pr comments --- .../add-edit-expense-1.spec.ts | 35 +++++++++---------- .../add-edit-expense-3.spec.ts | 4 +-- 2 files changed, 18 insertions(+), 21 deletions(-) diff --git a/src/app/fyle/add-edit-expense/add-edit-expense-1.spec.ts b/src/app/fyle/add-edit-expense/add-edit-expense-1.spec.ts index 581599d954..daad8bfd25 100644 --- a/src/app/fyle/add-edit-expense/add-edit-expense-1.spec.ts +++ b/src/app/fyle/add-edit-expense/add-edit-expense-1.spec.ts @@ -1063,11 +1063,9 @@ export function TestCases1(getTestBed) { launchDarklyService.getVariation.and.returnValue(of(true)); fixture.detectChanges(); - let actionSheetOptions; - - component.getActionSheetOptions().subscribe((res) => { - actionSheetOptions = res; - expect(res.length).toEqual(6); + component.getActionSheetOptions().subscribe((actionSheetOptionsResponse) => { + const actionSheetOptions = actionSheetOptionsResponse; + expect(actionSheetOptionsResponse.length).toEqual(6); expect(titleCasePipe.transform).toHaveBeenCalledOnceWith('Project'); expect(orgSettingsService.get).toHaveBeenCalledTimes(1); expect(projectsService.getAllActive).toHaveBeenCalledTimes(1); @@ -1075,21 +1073,20 @@ export function TestCases1(getTestBed) { 'show_project_mapped_categories_in_split_expense', false ); + actionSheetOptions[0].handler(); + expect(component.splitExpCategoryHandler).toHaveBeenCalledTimes(1); + actionSheetOptions[1].handler(); + expect(component.splitExpProjectHandler).toHaveBeenCalledTimes(1); + actionSheetOptions[2].handler(); + expect(component.splitExpCostCenterHandler).toHaveBeenCalledTimes(1); + actionSheetOptions[3].handler(); + expect(component.markPersonalHandler).toHaveBeenCalledTimes(1); + actionSheetOptions[4].handler(); + expect(component.markDismissHandler).toHaveBeenCalledTimes(1); + actionSheetOptions[5].handler(); + expect(component.removeCCCHandler).toHaveBeenCalledTimes(1); + done(); }); - - actionSheetOptions[0].handler(); - expect(component.splitExpCategoryHandler).toHaveBeenCalledTimes(1); - actionSheetOptions[1].handler(); - expect(component.splitExpProjectHandler).toHaveBeenCalledTimes(1); - actionSheetOptions[2].handler(); - expect(component.splitExpCostCenterHandler).toHaveBeenCalledTimes(1); - actionSheetOptions[3].handler(); - expect(component.markPersonalHandler).toHaveBeenCalledTimes(1); - actionSheetOptions[4].handler(); - expect(component.markDismissHandler).toHaveBeenCalledTimes(1); - actionSheetOptions[5].handler(); - expect(component.removeCCCHandler).toHaveBeenCalledTimes(1); - done(); }); it('should get action sheet options when split expense is not allowed', (done) => { diff --git a/src/app/fyle/add-edit-expense/add-edit-expense-3.spec.ts b/src/app/fyle/add-edit-expense/add-edit-expense-3.spec.ts index 66e3d70bb0..3a86151f9d 100644 --- a/src/app/fyle/add-edit-expense/add-edit-expense-3.spec.ts +++ b/src/app/fyle/add-edit-expense/add-edit-expense-3.spec.ts @@ -1244,8 +1244,8 @@ export function TestCases3(getTestBed) { component.recentlyUsedValues$ = of(recentlyUsedRes); fixture.detectChanges(); - component.getNewExpenseObservable().subscribe((res) => { - expect(res).toEqual(expectedExpenseObservable3); + component.getNewExpenseObservable().subscribe((newExpense) => { + expect(newExpense).toEqual(expectedExpenseObservable3); expect(component.source).toEqual('MOBILE_DASHCAM_SINGLE'); expect(component.isExpenseBankTxn).toBeFalse(); expect(component.instaFyleCancelled).toBeFalse();