Repository navigation
fix: nih account expiry warning says "1 days" (#1109) - #1140
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
Static review found no blocking issues in this focused fix with regression coverage; tests were not executed.
No open issues 🎉
What changed in this PR
Fixes #1109 by using “1 day” in the NIH account expiry warning while preserving existing rounding behavior.
Changes:
- Extracts expiry helpers into a testable utility module.
- Adds regression tests for singular, plural, and expiry boundary cases.
- Adds three Storybook examples for expired and expiring links.
| File | Description |
|---|---|
tests/nihAccountExpiryWarningUtils.test.ts |
Adds frozen-clock regression tests. |
src/components/Export/components/ExportToTerra/components/TerraSetUpForm/components/NIHAccountExpiryWarning/utils.ts |
Extracts helpers and fixes pluralization. |
src/components/Export/components/ExportToTerra/components/TerraSetUpForm/components/NIHAccountExpiryWarning/stories/nihAccountExpiryWarning.stories.tsx |
Adds three warning stories. |
src/components/Export/components/ExportToTerra/components/TerraSetUpForm/components/NIHAccountExpiryWarning/stories/args.ts |
Provides mock Terra profile contexts. |
src/components/Export/components/ExportToTerra/components/TerraSetUpForm/components/NIHAccountExpiryWarning/nihAccountExpiryWarning.tsx |
Uses extracted helpers and removes an unnecessary fallback. |
Review effort: Balanced
NoopDog
approved these changes
Oct 21, 2026
NoopDog
left a comment
Collaborator
There was a problem hiding this comment.
Thanks Fran, looks good.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Co-authored-by: cc-claude-tools <cc-claude-tools@clevercanary.com>
frano-m
force-pushed
the
frano-m/1109-nih-expiry-singular-day
branch
from
October 22, 2026 04:29
b710e1d to
99eb682
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1109
What changed
getExpiryMessagenow says "1 day" when the rounded-up count is 1 and "N days" otherwise.getExpireTimeInDaysandgetExpiryMessagemoved out ofnihAccountExpiryWarning.tsxinto a siblingutils.ts(per CODING_STANDARDS: no functions in component files) and are exported so they can be unit-tested. The component now destructuresuseAuthenticationNIHExpiry()directly (the|| {}fallback was unreachable).tests/nihAccountExpiryWarningUtils.test.ts(frozen clock; under a day, exactly a day, just over a day, several days, expired, missing/past timestamp).NIHAccountExpiryWarning— Expired, ExpiresInDays, ExpiresInOneDay — that mockTerraProfileContextso the real hook runs. They are also picked up by the a11y suite.Why
getExpireTimeInDaysrounds up, so any link expiring within 24 hours rendered "will expire in 1 days". Found in the #1038 review.Assumptions I made
days === 1ternary rather than a shared/Intl.PluralRuleshelper — this is the only count-plus-noun message in the library.Date.now()at module load, so a Storybook left open for many hours will drift. Fine for a demo; not used for visual snapshots.How to verify
npm test -- tests/nihAccountExpiryWarningUtils.test.ts— all tests pass.npm run storybook, open NIHAccountExpiryWarning (under the Export component path):Definition of done:
Screenshots
findable-ui-1109-expires-in-one-day.png— Expires In One Day story: "will expire in 1 day."findable-ui-1109-expires-in-days.png— Expires In Days story: "will expire in 3 days."findable-ui-1109-expired.png— Expired story: "has expired."findable-ui-1109-expiry-warning-stories.gif— clicking through the three stories in Storybook.🤖 Generated with Claude Code
🐦 Built with cc-claude-tools