Skip to content
This repository was archived by the owner on Feb 1, 2026. It is now read-only.

test(frontend): create shared badge test factory (Phase 3.2)#375

Merged
gander merged 1 commit into
mainfrom
test/badge-test-factory-phase3.2
Feb 1, 2026
Merged

test(frontend): create shared badge test factory (Phase 3.2)#375
gander merged 1 commit into
mainfrom
test/badge-test-factory-phase3.2

Conversation

@gander

@gander gander commented Feb 1, 2026

Copy link
Copy Markdown
Member

Summary

Phase 3.2 of Test Suite Quality Improvements - Create shared badge test factory utility to eliminate redundant badge component test patterns.

Changes

New Files:

  • packages/frontend/tests/utils/badge-test-factory.ts - Shared test utility for badge components

    • Generic createBadgeTestSuite<T> function
    • Supports custom prop names (default: 'status')
    • Supports multiple statuses with expected text and type
    • Tests standard badge behaviors: rendering, sizes, data-test attributes
    • Uses proper TypeScript types (Component instead of any)
  • packages/frontend/tests/utils/badge-test-factory.test.ts - Tests for factory utility

    • Verifies factory creates test suites without errors
    • Tests custom prop name support - Tests multiple status handling
    • Tests TypeScript type safety

Benefits

  • DRY Principle: Single source of truth for badge component test patterns
  • Type Safety: Full TypeScript support with generic types
  • Reusability: Can be used for all future badge components
  • Maintainability: Changes to standard badge tests only need to be made in one place

Future Usage

Once badge components exist in the frontend, this factory will be used to refactor:

  • ProjectStatusBadge
  • RunStatusBadge
  • PageStatusBadge
  • DiffBadge
  • RuleScopeBadge

Test Results

  • ✅ 501 tests passing on Node 22.21.1
  • ✅ 501 tests passing on Node 24.12.0
  • ✅ Biome CI passing for Phase 3.2 files
  • ✅ No any types used (proper TypeScript types throughout)

Related

🤖 Generated with Claude Code

@github-project-automation github-project-automation Bot moved this to Backlog in Diff Voyager Feb 1, 2026
@github-actions github-actions Bot added size/medium Medium effort: 2-4 hours of work frontend Frontend-related code (Vue.js, TypeScript, UI components) tests Test-related changes (unit, integration, e2e tests) labels Feb 1, 2026
@gander
gander force-pushed the test/badge-test-factory-phase3.2 branch from 5b2ded1 to b37e880 Compare February 1, 2026 12:45
@github-actions github-actions Bot added backend Backend-related code (Node.js, API, database, repositories) size/xlarge Extra large effort: 8+ hours of work and removed size/medium Medium effort: 2-4 hours of work labels Feb 1, 2026
- Add badge-test-factory.ts with createBadgeTestSuite function
- Generic factory for testing badge components with standard behavior
- Supports custom prop names and multiple statuses
- Add comprehensive tests for factory utility
- Tests verify factory works correctly before badge components exist
- Uses proper TypeScript types (Component instead of any)
- 501 tests passing on Node 22 and 24

Phase 3.2 of Test Suite Quality Improvements complete

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@gander
gander force-pushed the test/badge-test-factory-phase3.2 branch from b37e880 to 4314c13 Compare February 1, 2026 14:18
@github-actions github-actions Bot added size/medium Medium effort: 2-4 hours of work and removed backend Backend-related code (Node.js, API, database, repositories) size/xlarge Extra large effort: 8+ hours of work labels Feb 1, 2026
@gander
gander added this pull request to the merge queue Feb 1, 2026
Merged via the queue into main with commit 0417a31 Feb 1, 2026
17 checks passed
@gander
gander deleted the test/badge-test-factory-phase3.2 branch February 1, 2026 14:21
@github-project-automation github-project-automation Bot moved this from Backlog to Done in Diff Voyager Feb 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

frontend Frontend-related code (Vue.js, TypeScript, UI components) size/medium Medium effort: 2-4 hours of work tests Test-related changes (unit, integration, e2e tests)

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant