Skip to content

Test: Add fallback unit tests for formatLocaleDate and formatLocaleTime #78#173

Open
SaumyaT-21 wants to merge 2 commits into
utksh1:mainfrom
SaumyaT-21:fix/date-fallback-78
Open

Test: Add fallback unit tests for formatLocaleDate and formatLocaleTime #78#173
SaumyaT-21 wants to merge 2 commits into
utksh1:mainfrom
SaumyaT-21:fix/date-fallback-78

Conversation

@SaumyaT-21
Copy link
Copy Markdown

@SaumyaT-21 SaumyaT-21 commented May 19, 2026

Description

Added fallback unit tests for formatLocaleDate and formatLocaleTime (issue #78) to safely handle "undefined" and "null" user inputs. Ensures that the system won't crash and will cleanly fall back to returning "N/A" if empty values leak through.

Related Issues

Closes #78

Type of Change

  • [ x ] Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

How Has This Been Tested?

Ran the local Vitest testing framework inside the frontend folder.
Verified that the test suite inside testing/unit/utils/date.test.ts successfully expanded from 15 passing tests to 19 passing tests, proving the new fallback paths work under simulation.

Checklist

  • [ x ] My code follows the code style of this project.
  • [ x ] I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • [ x ] My changes generate no new warnings.

Copy link
Copy Markdown
Owner

@utksh1 utksh1 left a comment

Choose a reason for hiding this comment

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

Thanks! A couple quick nits before merge:\n\n- Fix typos: -> in test names.\n- Minor formatting: remove extra space in and align arrow spacing for consistency.\n\nAlso, since this is frontend-only, if backend-tests are failing due to unrelated CI flakiness, please rerun CI once the above is fixed.

Copy link
Copy Markdown
Owner

@utksh1 utksh1 left a comment

Choose a reason for hiding this comment

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

Thanks! A couple quick nits before merge:

  • Fix typos in test names: “undefinied” -> “undefined”.
  • Minor formatting: remove extra space in expect(...) and keep arrow spacing consistent.

Also, since this is frontend-only, if backend-tests are failing due to unrelated CI flakiness, please rerun CI once the above is fixed.

@utksh1 utksh1 added area:frontend Frontend React/UI work type:testing Testing work category bonus label level:beginner 20 pts difficulty label for small beginner-friendly PRs labels May 22, 2026
@SaumyaT-21
Copy link
Copy Markdown
Author

Hey @utksh1! I've finished the chore fixes and linked the issue. It's ready for a final review whenever you have a moment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:frontend Frontend React/UI work level:beginner 20 pts difficulty label for small beginner-friendly PRs type:testing Testing work category bonus label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[GOOD FIRST ISSUE] Add unit tests for formatLocaleDate and formatLocaleTime fallback behavior

2 participants