Files
gastown/internal/cmd/synthesis_test.go
Johann Dirry 3d5a66f850 Fixing unit tests on windows (#813)
* Add Windows stub for orphan cleanup

* Fix account switch tests on Windows

* Make query session events test portable

* Disable beads daemon in query session events test

* Add Windows bd stubs for sling tests

* Make expandOutputPath test OS-agnostic

* Make role_agents test Windows-friendly

* Make config path tests OS-agnostic

* Make HealthCheckStateFile test OS-agnostic

* Skip orphan process check on Windows

* Normalize sparse checkout detail paths

* Make dog path tests OS-agnostic

* Fix bare repo refspec config on Windows

* Add Windows process detection for locks

* Add Windows CI workflow

* Make mail path tests OS-agnostic

* Skip plugin file mode test on Windows

* Skip tmux-dependent polecat tests on Windows

* Normalize polecat paths and AGENTS.md content

* Make beads init failure test Windows-friendly

* Skip rig agent bead init test on Windows

* Make XDG path tests OS-agnostic

* Make exec tests portable on Windows

* Adjust atomic write tests for Windows

* Make wisp tests Windows-friendly

* Make workspace find tests OS-agnostic

* Fix Windows rig add integration test

* Make sling var logging Windows-friendly

* Fix sling attached molecule update ordering

---------

Co-authored-by: Johann Dirry <johann.dirry@microsea.at>
2026-01-20 14:17:35 -08:00

96 lines
2.1 KiB
Go

package cmd
import (
"path/filepath"
"testing"
)
func TestExpandOutputPath(t *testing.T) {
tests := []struct {
name string
directory string
pattern string
reviewID string
legID string
want string
}{
{
name: "basic expansion",
directory: ".reviews/{{review_id}}",
pattern: "{{leg.id}}-findings.md",
reviewID: "abc123",
legID: "security",
want: ".reviews/abc123/security-findings.md",
},
{
name: "no templates",
directory: ".output",
pattern: "results.md",
reviewID: "xyz",
legID: "test",
want: ".output/results.md",
},
{
name: "complex path",
directory: "reviews/{{review_id}}/findings",
pattern: "leg-{{leg.id}}-analysis.md",
reviewID: "pr-123",
legID: "performance",
want: "reviews/pr-123/findings/leg-performance-analysis.md",
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got := expandOutputPath(tt.directory, tt.pattern, tt.reviewID, tt.legID)
if filepath.ToSlash(got) != tt.want {
t.Errorf("expandOutputPath() = %q, want %q", got, tt.want)
}
})
}
}
func TestLegOutput(t *testing.T) {
// Test LegOutput struct
output := LegOutput{
LegID: "correctness",
Title: "Correctness Review",
Status: "closed",
FilePath: "/tmp/findings.md",
Content: "## Findings\n\nNo issues found.",
HasFile: true,
}
if output.LegID != "correctness" {
t.Errorf("LegID = %q, want %q", output.LegID, "correctness")
}
if output.Status != "closed" {
t.Errorf("Status = %q, want %q", output.Status, "closed")
}
if !output.HasFile {
t.Error("HasFile should be true")
}
}
func TestConvoyMeta(t *testing.T) {
// Test ConvoyMeta struct
meta := ConvoyMeta{
ID: "hq-cv-abc",
Title: "Code Review: PR #123",
Status: "open",
Formula: "code-review",
ReviewID: "pr123",
LegIssues: []string{"gt-leg1", "gt-leg2", "gt-leg3"},
}
if meta.ID != "hq-cv-abc" {
t.Errorf("ID = %q, want %q", meta.ID, "hq-cv-abc")
}
if len(meta.LegIssues) != 3 {
t.Errorf("len(LegIssues) = %d, want 3", len(meta.LegIssues))
}
}