Skip to content

Add in unit tests for Data and Utility functions CRASM-3507#1484

Merged
cduhn17 merged 2 commits intodevelopfrom
CRASM-3507
Jan 30, 2026
Merged

Add in unit tests for Data and Utility functions CRASM-3507#1484
cduhn17 merged 2 commits intodevelopfrom
CRASM-3507

Conversation

@jyang2139
Copy link
Contributor

🗣 Description

These tests verify the severity color utilities return the expected colors for each severity and stay consistent across helpers. They also validate the date utilities format dates and ranges correctly, handle timezone conversions, and cover key edge cases and invalid inputs to prevent regressions.

💭 Motivation and context

Make sure we validate these shared utility functions (dates and severity colors), so UI changes and refactors don’t accidentally break formatting or user workflows across the app.

🧪 Testing

Tested locally
dateUtils.ts : 33 tests
getSeverityColor.ts: 7 tests

✅ Pre-approval checklist

  • This PR has an informative and human-readable title.
  • Changes are limited to a single goal - eschew scope creep!
  • All future TODOs are captured in issues, which are referenced in code comments.
  • All relevant type-of-change labels have been added.
  • I have read the CONTRIBUTING document.
  • These code changes follow cisagov code standards.
  • All relevant repo and/or project documentation has been updated to reflect the changes in this PR.
  • Tests have been added and/or modified to cover the changes in this PR.
  • All new and existing tests pass.

@coveralls
Copy link

Coverage Status

coverage: 43.455% (+0.4%) from 43.08%
when pulling b83e1e5 on CRASM-3507
into fa73a16 on develop.

@jyang2139 jyang2139 requested a review from ameliav January 29, 2026 20:17
Copy link
Collaborator

@cduhn17 cduhn17 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@rapidray12 rapidray12 left a comment

Choose a reason for hiding this comment

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

The test scripts are now broken up (segmented in their own files) which makes them easier to follow

I don't like the hard coded dates. The dates should be declared separately. Same thing with the hard coded colors

We need to sit down and come up with a scheme to organize all of the constants used by the testing routines. It will make it much easier in the future to update the tests

@cduhn17 cduhn17 merged commit f68da0f into develop Jan 30, 2026
17 of 18 checks passed
@cduhn17 cduhn17 deleted the CRASM-3507 branch January 30, 2026 15:37
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.

6 participants