Skip to content

test: add unit tests for internal/status — health check suite #20

@jpleva91

Description

@jpleva91

Problem

internal/status/status.go has zero test coverage. The Run() function performs 5 health checks (binary, policy, Claude hooks, Copilot hooks, identity). If these misreport status, chitin status gives users wrong information about their setup.

Acceptance Criteria

  • Test Run() returns a list of Check results
  • Test checkPolicy() returns OK=true when chitin.yaml exists and OK=false when missing
  • Test checkClaudeHooks() returns OK=true when settings.json contains "chitin"
  • Test checkCopilotHooks() returns OK=true when hooks.json contains "chitin"
  • Test checkIdentity() returns OK=true when .chitin-identity exists
  • Test Print() returns exit code 0 when all critical checks pass
  • Test Print() returns exit code 1 when a critical check fails
  • Test Print() quiet mode output
  • All tests use t.TempDir() for filesystem isolation
  • All tests pass with go test ./internal/status/...

Hints

  • File: internal/status/status.go
  • Functions: Run(projectDir string), Print(checks []Check, quiet bool), checkPolicy(), checkClaudeHooks(), checkCopilotHooks(), checkIdentity()
  • Type: Check{Name, OK, Detail, Critical}
  • Note: checkBinary() depends on PATH — may need to skip or mock
  • Create test file: internal/status/status_test.go

Generated by /forge fill

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions