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: make traffic usage test more robust by using this month's actual numbers #9193

Merged
merged 2 commits into from
Feb 3, 2025

Conversation

thomasheartman
Copy link
Contributor

The test was breaking because it assumed a month would have at least
30 days.

Because the test relies on the current month, this isn't necessarily true.

Further, there's parts of the code that relies on "impure" state via
the "current date" (which will change based on when you run it), so
setting a specific month in the test won't work.

As such, this test makes the calculation explicit and uses the number
of days in the current month.

Verified

This commit was signed with the committer’s verified signature.
thomasheartman Thomas Heartman
… numbers

The test was breaking because it assumed a month would have at least
30 days.

Because the test relies on the current month, this isn't necessarily true.

Further, there's parts of the code that relies on "impure" state via
the "current date" (which will change based on when you run it), so
setting a specific month in the test won't work.

As such, this test makes the calculation explicit and uses the number
of days in the current month.

Verified

This commit was signed with the committer’s verified signature.
thomasheartman Thomas Heartman
Copy link

vercel bot commented Feb 3, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
unleash-monorepo-frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 3, 2025 1:28pm
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
unleash-docs ⬜️ Ignored (Inspect) Visit Preview Feb 3, 2025 1:28pm

Copy link
Contributor

github-actions bot commented Feb 3, 2025

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

OpenSSF Scorecard

PackageVersionScoreDetails

Scanned Files

@thomasheartman thomasheartman enabled auto-merge (squash) February 3, 2025 13:25
Copy link
Member

@nunogois nunogois left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for having a look!

Copy link
Member

@sighphyre sighphyre left a comment

Choose a reason for hiding this comment

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

LGTM

@thomasheartman thomasheartman merged commit fd1ad31 into main Feb 3, 2025
10 of 11 checks passed
@thomasheartman thomasheartman deleted the fix/traffic-usage-data-test branch February 3, 2025 13:29
Copy link
Contributor

@gastonfournier gastonfournier left a comment

Choose a reason for hiding this comment

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

Nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

4 participants