Skip to content

test: sandbox testing infrastructure for feed producers (project, calendar, weather) #63

Description

@vishnujayvel

Problem

Feed producer verification currently requires manual testing on a local dev machine:

  • ProjectProducer: tested by cd-ing to different git repos and checking hookwise status-line output
  • CalendarProducer: requires real Google OAuth token and calendar events
  • WeatherProducer: requires network access to Open-Meteo API

There's no CI-compatible sandbox that can validate these producers end-to-end.

What's needed

A hermetic testing infrastructure that can run in CI (GitHub Actions) to validate feed producers produce correct data and the full pipeline (producer → daemon cache → bridge → status-line render) works.

Scope

  1. Git sandbox for ProjectProducer:

    • Create temp git repos with known state (specific branch, commits, dirty/clean)
    • Verify producer output matches expected values
    • Test edge cases: detached HEAD, empty repo (no commits), shallow clone, non-git directory
    • Could use git init + scripted commits in a temp directory
  2. Calendar mock server for CalendarProducer:

    • HTTP test server that mimics Google Calendar API responses
    • CalendarProducer already has a baseURL field for endpoint override
    • Generate deterministic events (upcoming, current, all-day, past)
    • Test token refresh flow with mock OAuth endpoint
  3. Weather mock server for WeatherProducer:

    • HTTP test server mimicking Open-Meteo API
    • WeatherProducer already uses p.client which can be injected
    • Deterministic responses for various weather codes
  4. Full pipeline integration test:

    • Start daemon with mock/sandbox producers
    • Wait for cache files to be written
    • Run hookwise status-line and verify rendered output contains expected segments
    • This closes the Go→JSON→CLI rendering gap

Non-goals (for now)

  • Real API integration tests (too flaky for CI)
  • TUI snapshot tests for feed data (covered separately)

Context

During #57 (ProjectProducer fix), verification required:

  1. Rebuilding the binary (make install)
  2. Manually writing cache files to ~/.hookwise/state/project.json
  3. Running hookwise status-line in two different repos
  4. Visual inspection of ANSI output

This manual process is error-prone and doesn't scale to CI.

Related

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions