Skip to content

Commit

Permalink
fix(angular): round license expiration countdown number
Browse files Browse the repository at this point in the history
  • Loading branch information
jourdiw committed Mar 18, 2024
1 parent 61198c9 commit 799e7f3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
Expand Up @@ -109,6 +109,17 @@ describe('GioLicenseExpirationNotificationComponent', () => {
expect(await harness.getTitleText()).toEqual('Your license will expire in 10 days');
});

it('should display countdown message of whole number', async () => {
const expirationDate = new Date();
expirationDate.setDate(expirationDate.getDate() + 29);

component.expirationDate = expirationDate;
fixture.detectChanges();

const harness = await loader.getHarness(GioLicenseExpirationNotificationHarness);
expect(await harness.getTitleText()).toEqual('Your license will expire in 29 days');
});

it('should display call to action', async () => {
component.showCallToAction = true;
fixture.detectChanges();
Expand Down
Expand Up @@ -52,7 +52,7 @@ export class GioLicenseExpirationNotificationComponent implements OnInit, OnChan

const date = new Date();
const timeRemaining = this.transformDateWithoutHours(this.expirationDate) - this.transformDateWithoutHours(date);
this.daysRemaining = timeRemaining / (1000 * 3600 * 24);
this.daysRemaining = Math.round(timeRemaining / (1000 * 3600 * 24));

if (this.expirationDate.getTime() - date.getTime() < 0) {
this.title = 'Your license has expired';
Expand Down

0 comments on commit 799e7f3

Please sign in to comment.