Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Add tests for Virtual Cards changes #2741

Merged
merged 165 commits into from
Feb 21, 2024

Conversation

bistaastha
Copy link
Contributor

@bistaastha bistaastha commented Feb 7, 2024

Description

copilot:summary

copilot:poem

Walkthrough

copilot:walkthrough

Clickup

Code Coverage

Please add code coverage here

UI Preview

Please add screenshots for UI changes

@bistaastha bistaastha changed the base branch from FYLE-86cuaht42-6 to master February 19, 2024 05:32
@bistaastha bistaastha changed the base branch from master to FYLE-86cuaht42-6 February 19, 2024 05:37
spenderPlatformV1ApiService.get.and.returnValue(of(virtualCardUndefinedResponse));

virtualCardsService.getVirtualCard(virtualCardsRequest).subscribe((res) => {
console.log(res);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove console.log

});

it('getCardDetailsInSerial(): should return serialised card details', () => {
const virtualCardsCombinedRequest: VirtualCardsCombinedRequest = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

declare this in separate virtual-cards-combined-request.data.ts file and import here

[showAddCardSlide]="canAddCorporateCards$ | async"
(addCardClick)="openAddCorporateCardPopover()"
></app-spent-cards>
<ng-container *ngIf="isVirtualCardsEnabled.enabled === true">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use <ng-container *ngIf="isVirtualCardsEnabled.enabled">

@@ -187,6 +201,40 @@ describe('ManageCorporateCardsPage', () => {
expect(router.navigate).toHaveBeenCalledOnceWith(['/', 'enterprise', 'my_profile']);
});

describe('segmentChanged():', () => {
it('should show Virtual Card page', () => {
component.ionViewWillEnter();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this need to be called in test here?

);
});

it('copyToClipboard(): should copy cvv on cvv copy icon tap', () => {
Copy link
Contributor

@suyashpatil78 suyashpatil78 Feb 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add copyToClipboard tests together using describe block (another test is at line 44)

component.ionViewWillEnter();
component.virtualCardDetails$.subscribe((virtualCardDetailsRes) => {
expect(virtualCardDetailsRes).toBeDefined();
console.log(virtualCardDetailsRes);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove console logs


component.ionViewWillEnter();
component.virtualCardDetails$.subscribe((virtualCardDetailsRes) => {
expect(virtualCardDetailsRes).toBeDefined();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it is defined what should be the value?

@suyashpatil78
Copy link
Contributor

Some comments @bistaastha! Rest LGTM

@bistaastha bistaastha changed the base branch from FYLE-86cuaht42-6 to FYLE-86cuaht42 February 20, 2024 18:37
Copy link

Unit Test Coverage % values
Statements 97.02% ( 19180 / 19769 )
Branches 94.93% ( 9888 / 10416 )
Functions 95.88% ( 5828 / 6078 )
Lines 97.06% ( 18286 / 18838 )

@bistaastha bistaastha merged commit dc12842 into FYLE-86cuaht42 Feb 21, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/L Large PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants