This repository was archived by the owner on Feb 1, 2026. It is now read-only.
refactor(tests): integrate UUID helper and badge factory into existing tests#379
Merged
refactor(tests): integrate UUID helper and badge factory into existing tests#379
Conversation
Reduces redundant UUID validation test code across: - project-runs-list-endpoint.test.ts - run-details-endpoint.test.ts - run-pages-list-endpoint.test.ts - task-status-endpoint.test.ts - page-diff-endpoint.test.ts Updated uuid-validation.ts helper to work as async function inside it() blocks rather than creating describe() blocks. Skipped files (intentionally): - api-security.test.ts (comprehensive security tests) - page-details-endpoint.test.ts (404 scenarios) - ts-rest-routes.test.ts (URL validation) Test results: - All 631 tests passing (Node 22 and Node 24) - Coverage maintained at 75.56% - Biome checks passing Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Enhances badge test factory with animation support and applies to: - RunStatusBadge.test.ts (with animation) - PageStatusBadge.test.ts (with animation) - RuleScopeBadge.test.ts (no animation) Factory enhancements: - Added shouldAnimate flag to status config - Added animationClass config option - Added defaultSize and defaultDataTestId config - Generate animation tests conditionally - Simplified class assertions (removed type checks that don't work with NBadge) Skipped components (intentionally): - ProjectStatusBadge (needs enum refactoring first) - DiffBadge (variant pattern too complex for factory) Test results: - All 499 frontend tests passing - Reduces ~55 lines of redundant badge test code - Centralized test logic for better maintainability Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
Integrates Phase 3.2 and 3.3 test helpers that were created but not yet applied to existing tests:
Total Impact: Eliminates ~118 lines of redundant test code while maintaining 100% coverage.
Changes
Phase 1: UUID Validation Helper Integration
Files Modified (5 API endpoint tests):
project-runs-list-endpoint.test.tsrun-details-endpoint.test.tsrun-pages-list-endpoint.test.tstask-status-endpoint.test.tspage-diff-endpoint.test.tsHelper Enhancement:
uuid-validation.tsto work as async function insideit()blocksdescribe()blocks to being callable directly in testsPattern:
Intentionally Skipped:
api-security.test.ts- Comprehensive security tests with 5 UUID variationspage-details-endpoint.test.ts- Tests 404 scenarios (non-existent entity)ts-rest-routes.test.ts- Tests URL validation in body, not path paramsPhase 2: Badge Test Factory Integration
Files Modified (4):
badge-test-factory.ts- Enhanced with animation supportRunStatusBadge.test.ts- Reduced from 64 to 42 linesPageStatusBadge.test.ts- Reduced from 74 to 48 linesRuleScopeBadge.test.ts- Reduced from 64 to 27 linesFactory Enhancements:
shouldAnimate?: booleanflag toBadgeStatusConfiganimationClass?: stringtoBadgeTestConfigdefaultSizeanddefaultDataTestIdconfig optionsPattern:
Intentionally Skipped:
ProjectStatusBadge- Uses string prop instead of enum (needs component refactoring)DiffBadge- Variant pattern too complex for factory (type + severity combinations)Test Plan
Backend Tests
Frontend Tests
Code Quality
Benefits
Related Issues
🤖 Generated with Claude Code