Skip to content

Add test fixtures to enable CI testing #14

@Fuabioo

Description

@Fuabioo

Problem

Some tests depend on actual Claude Code history existing on the machine, causing them to skip in CI environments.

Evidence

conversation_test.go:9-40

func TestScanConversationMeta(t *testing.T) {
    projectsDir := DefaultProjectsDir()  // ~/.claude/projects
    projects, err := ListProjects(projectsDir)
    if err != nil {
        t.Skipf("No projects found: %v", err)
    }
    if len(projects) == 0 {
        t.Skip("No projects available")
    }
    // ...
}

This test:

  • Requires actual Claude Code history in ~/.claude/projects
  • Skips in CI (no Claude data)
  • Skips on fresh dev machines
  • Skips on machines without Claude Code installed

Impact

Tests that skip provide no value in CI - you can't verify the code works correctly in automated pipelines.

Suggested Fix

  1. Create test fixtures - Sample JSONL files with realistic conversation data
  2. Use a testdata directory - Standard Go convention for test fixtures
  3. Mock the filesystem or use temp directories with fixture data
  4. Keep existing tests but add parallel fixture-based tests that always run

Example structure:

internal/history/testdata/
  projects/
    -Users-test-project/
      session-abc123.jsonl
      agent-def456.jsonl

Files: internal/history/conversation_test.go:9-40

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions