test(badges): add unit tests for condition-badge, status-badge, and validation - #1375
Merged
yusuftomilola merged 1 commit intoAug 26, 2026
Conversation
…alidation Tests every AssetCondition and AssetStatus enum value against expected label text and Tailwind color classes. Covers the fallback path for unknown values. Files: condition-badge.test.tsx (6 tests), status-badge.test.tsx (5 tests), validation.test.tsx (5 tests). Closes DistinctCodes#1299
|
@ibrahimmosouf-png is attempting to deploy a commit to the naijabuz's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
@ibrahimmosouf-png Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
yusuftomilola
approved these changes
Aug 26, 2026
yusuftomilola
left a comment
Collaborator
There was a problem hiding this comment.
No merge conflicts with main. Good unit test coverage for the badge components and validation - approving.
Closed
3 tasks
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.
Summary
Closes #1299
Closes #1296
Closes #1297
Closes #1298
Adds co-located unit tests for
condition-badge.tsx,status-badge.tsx, andvalidation.tsx— three high-reuse components infrontend/components/assets/that had no test coverage despite being used across the assets list, detail page, and both modals.Why
These badge components render status/condition values with specific Tailwind color classes that are easy to accidentally break during styling changes. Without tests, a regression in color mapping (e.g., swapping
bg-green-100forbg-red-100on the ACTIVE status) would go unnoticed until a visual review. The tests assert both the correct label text and the correct Tailwind class strings for every enum value.What was built
frontend/components/assets/condition-badge.test.tsx:bg-emerald-100 text-emerald-800bg-green-100 text-green-800bg-yellow-100 text-yellow-900bg-orange-100 text-orange-900bg-red-100 text-red-800bg-gray-100 text-gray-700frontend/components/assets/status-badge.test.tsx:bg-green-100 text-green-800bg-blue-100 text-blue-800bg-yellow-100 text-yellow-900bg-gray-100 text-gray-700bg-gray-100 text-gray-700frontend/components/assets/validation.test.tsx:bg-green-100 text-green-700bg-blue-100 text-blue-700bg-yellow-100 text-yellow-700bg-gray-100 text-gray-500bg-gray-100 text-gray-500No existing files modified — only additions, so regression risk is low.
Acceptance criteria coverage
Test plan
npm testinfrontend/— 16/16 passing (all new tests for this feature)Env vars / Notes
No new environment variables. Tests use
@testing-library/reactwith the existingjest-environment-jsdomconfiguration infrontend/jest.config.js.