Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sumrender committed Jan 7, 2025
1 parent 441e267 commit 9e5861b
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/app/core/services/personal-cards.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ describe('PersonalCardsService', () => {
limit: platformTxnsConfig.limit,
offset: platformTxnsConfig.offset,
...platformTxnsConfig.queryParams,
order: 'spent_at.desc,id.desc',
},
});
done();
Expand Down
20 changes: 15 additions & 5 deletions src/app/fyle/add-edit-expense/add-edit-expense-4.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,9 @@ export function TestCases4(getTestBed) {
'success',
['msb-success']
);
expect(router.navigate).toHaveBeenCalledOnceWith(['/', 'enterprise', 'personal_cards']);
expect(router.navigate).toHaveBeenCalledOnceWith(['/', 'enterprise', 'personal_cards'], {
queryParams: { refresh: true },
});
expect(trackingService.newExpenseCreatedFromPersonalCard).toHaveBeenCalledOnceWith();
});

Expand Down Expand Up @@ -695,7 +697,9 @@ export function TestCases4(getTestBed) {
'success',
['msb-success']
);
expect(router.navigate).toHaveBeenCalledOnceWith(['/', 'enterprise', 'personal_cards']);
expect(router.navigate).toHaveBeenCalledOnceWith(['/', 'enterprise', 'personal_cards'], {
queryParams: { refresh: true },
});
expect(trackingService.newExpenseCreatedFromPersonalCard).toHaveBeenCalledOnceWith();
});

Expand Down Expand Up @@ -751,7 +755,9 @@ export function TestCases4(getTestBed) {
'success',
['msb-success']
);
expect(router.navigate).toHaveBeenCalledOnceWith(['/', 'enterprise', 'personal_cards']);
expect(router.navigate).toHaveBeenCalledOnceWith(['/', 'enterprise', 'personal_cards'], {
queryParams: { refresh: true },
});
expect(trackingService.newExpenseCreatedFromPersonalCard).toHaveBeenCalledOnceWith();
});

Expand Down Expand Up @@ -798,7 +804,9 @@ export function TestCases4(getTestBed) {
'success',
['msb-success']
);
expect(router.navigate).toHaveBeenCalledOnceWith(['/', 'enterprise', 'personal_cards']);
expect(router.navigate).toHaveBeenCalledOnceWith(['/', 'enterprise', 'personal_cards'], {
queryParams: { refresh: true },
});
expect(trackingService.newExpenseCreatedFromPersonalCard).toHaveBeenCalledOnceWith();
});

Expand Down Expand Up @@ -845,7 +853,9 @@ export function TestCases4(getTestBed) {
'success',
['msb-success']
);
expect(router.navigate).toHaveBeenCalledOnceWith(['/', 'enterprise', 'personal_cards']);
expect(router.navigate).toHaveBeenCalledOnceWith(['/', 'enterprise', 'personal_cards'], {
queryParams: { refresh: true },
});
expect(trackingService.newExpenseCreatedFromPersonalCard).toHaveBeenCalledOnceWith();
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@ describe('ExpensePreviewComponent', () => {

expect(personalCardsService.matchExpense).toHaveBeenCalledWith('testExpenseId', 'testCardTxnId');
expect(modalController.dismiss).toHaveBeenCalledTimes(1);
expect(router.navigate).toHaveBeenCalledWith(['/', 'enterprise', 'personal_cards']);
expect(router.navigate).toHaveBeenCalledOnceWith(['/', 'enterprise', 'personal_cards'], {
queryParams: { refresh: true },
});
expect(trackingService.oldExpensematchedFromPersonalCard).toHaveBeenCalledTimes(1);
});
});

0 comments on commit 9e5861b

Please sign in to comment.