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

fix: getWarningInfo test #239

Merged
merged 1 commit into from
Jan 7, 2025
Merged

fix: getWarningInfo test #239

merged 1 commit into from
Jan 7, 2025

Conversation

paulpascal
Copy link
Contributor

Description

This PR fixes #238, The tests would sometimes fail due to Luxon’s behavior of adjusting the date context based on the system’s current date.

To resolve this, we mocked the system clock in the test setup to ensure a fixed middle date (June 15, 2024) for consistent relative date calculations. This prevents test failures caused by discrepancies between the actual system date and the expected relative descriptions.

Copy link
Contributor

@inromualdo inromualdo left a comment

Choose a reason for hiding this comment

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

@@ -146,9 +146,25 @@ describe('lib/manage-hierarchy.ts', () => {
});

describe('getWarningInfo', () => {
let clock;
Copy link
Contributor

Choose a reason for hiding this comment

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

@paulpascal , this will fix the tests, but it will be different in the app. Is it ok like that? If not, I will suggest to move to another library for the relatives... javascript-time-ago is used here...

What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @inromualdo - Yes you are right this will only fix the test, lets handle that properly in another PR.

cc: @kennsippell

@paulpascal paulpascal merged commit fbe22da into main Jan 7, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix Date Behavior in getWarningInfo Tests
2 participants