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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(angular): round license expiration countdown number #379

Merged
merged 1 commit into from Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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