Skip to content

test: add test infrastructure and initial test suite #46

Description

@teckedd-code2save

Summary

Convoy is a core Serendepify product — a deterministic deploy agent with real stage runners (GitHub PR creation, Fly.io deploy, local rehearsal). Despite its production-grade features, the repo has no test infrastructure or test files.

What to do

  1. Add a test runner (e.g., vitest — used by other repos in the org) to the root package.json
  2. Write unit tests for the core modules:
    • src/core/ — orchestrator, state store, event bus, medic
    • src/planner/ — scanner, picker, author (especially the template logic)
    • src/adapters/fly/runner.ts — shell wrappers (mock flyctl)
  3. Add integration tests for the rehearsal runner (src/core/rehearsal-runner.ts) with a mock target
  4. Configure the existing ci.yml workflow to run npm test (or npm run typecheck && npm test)
  5. Consider npx vitest --coverage for coverage reporting

Why it matters

  • Regression protection: Real stage runners execute shell commands and modify state. Without tests, a refactor or new adapter silently breaks existing flows.
  • CI gates: Tests block bad merges. The CI workflow exists but only does typechecking — adding tests gives us a proper safety net.
  • Onboarding: New contributors (human or AI) rely on npm test to validate their changes. Missing tests means every change is a blind push.

Acceptance criteria

  • npm test (or npm run test) passes with at least one test file
  • Core planner modules have unit tests
  • CI workflow runs npm test
  • A tests/ directory exists at repo root with at least 3 test files covering real logic

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions