-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
4 changed files
with
101 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,12 +32,12 @@ describe('InvitationsDialog', () => { | |
}); | ||
}); | ||
|
||
it('should exist', async () => { | ||
it('exists', async () => { | ||
const { element } = await shallow.render(); | ||
expect(element).not.toBeNull(); | ||
}); | ||
|
||
it('should display the pending invitations table if there are any invitations pending', async () => { | ||
it('displays the pending invitations table if there are any invitations pending', async () => { | ||
const { fixture, find, instance } = await shallow.render(); | ||
instance.activeTab = 'pending'; | ||
instance.pendingInvites = [new InviteVO({ email: '[email protected]' })]; | ||
|
@@ -49,7 +49,7 @@ describe('InvitationsDialog', () => { | |
expect(table.length).toBe(instance.pendingInvites.length); | ||
}); | ||
|
||
it('should display the "no pending invites" message if there are no invites', async () => { | ||
it('displays the "no pending invites" message if there are no invites', async () => { | ||
const { fixture, find, instance } = await shallow.render(); | ||
instance.activeTab = 'pending'; | ||
instance.pendingInvites = []; | ||
|
@@ -61,7 +61,7 @@ describe('InvitationsDialog', () => { | |
expect(message).not.toBeNull(); | ||
}); | ||
|
||
it('should display the accepted invitations table if there are any accepted pending', async () => { | ||
it('displays the accepted invitations table if there are any accepted pending', async () => { | ||
const { fixture, find, instance } = await shallow.render(); | ||
instance.activeTab = 'accepted'; | ||
instance.acceptedInvites = [new InviteVO({ email: '[email protected]' })]; | ||
|
@@ -73,7 +73,7 @@ describe('InvitationsDialog', () => { | |
expect(table.length).toBe(instance.acceptedInvites.length); | ||
}); | ||
|
||
it('should display the "no accepted invites" message if there are no invites', async () => { | ||
it('displays the "no accepted invites" message if there are no invites', async () => { | ||
const { fixture, find, instance } = await shallow.render(); | ||
instance.activeTab = 'accepted'; | ||
instance.acceptedInvites = []; | ||
|
@@ -84,4 +84,64 @@ describe('InvitationsDialog', () => { | |
|
||
expect(message).not.toBeNull(); | ||
}); | ||
|
||
it('displays the gifted amount in the table if there is any, otherwise display the "None Given" text', async () => { | ||
const { fixture, find, instance } = await shallow.render(); | ||
instance.activeTab = 'pending'; | ||
instance.pendingInvites = [ | ||
new InviteVO({ email: '[email protected]', giftSizeInMB: 1024 }), | ||
new InviteVO({ email: '[email protected]', giftSizeInMB: null }), | ||
new InviteVO({ email: '[email protected]', giftSizeInMB: 1024 }), | ||
new InviteVO({ email: '[email protected]', giftSizeInMB: null }), | ||
new InviteVO({ email: '[email protected]', giftSizeInMB: 1024 }), | ||
]; | ||
|
||
fixture.detectChanges(); | ||
|
||
const invitesWithGift = find('.has-amount'); | ||
const invitesWithoutGift = find('.none'); | ||
|
||
expect(invitesWithGift.length).toBe(3); | ||
expect(invitesWithoutGift.length).toBe(2); | ||
}); | ||
|
||
it('displays the amount sent in the invite', async () => { | ||
const { fixture, find, instance } = await shallow.render(); | ||
instance.activeTab = 'pending'; | ||
instance.pendingInvites = [ | ||
new InviteVO({ email: '[email protected]', giftSizeInMB: 1024 }), | ||
new InviteVO({ email: '[email protected]', giftSizeInMB: 2048 }), | ||
new InviteVO({ email: '[email protected]', giftSizeInMB: 1024 }), | ||
]; | ||
|
||
fixture.detectChanges(); | ||
|
||
const invitesWithGift = find('.has-amount'); | ||
|
||
const giftedAmount = invitesWithGift[1].nativeElement.textContent.trim(); | ||
|
||
const expectedText = `${instance.pendingInvites[1].giftSizeInMB / 1024} GB`; | ||
|
||
expect(giftedAmount).toBe(expectedText); | ||
}); | ||
|
||
it('displays the "None given" text if no amount was sent in the invite', async () => { | ||
const { fixture, find, instance } = await shallow.render(); | ||
instance.activeTab = 'pending'; | ||
instance.pendingInvites = [ | ||
new InviteVO({ email: '[email protected]', giftSizeInMB: 1024 }), | ||
new InviteVO({ email: '[email protected]', giftSizeInMB: null }), | ||
new InviteVO({ email: '[email protected]', giftSizeInMB: 1024 }), | ||
]; | ||
|
||
fixture.detectChanges(); | ||
|
||
const invitesWithGift = find('.invitation .amount'); | ||
|
||
const giftedAmount = invitesWithGift[1].nativeElement.textContent.trim(); | ||
|
||
const expectedText = `None given`; | ||
|
||
expect(giftedAmount).toBe(expectedText); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters