Files
wehub-resource-sync 26f897c1ec
release / release-please (push) Failing after 1m49s
docs / build (push) Failing after 6m34s
release / build-and-upload (arm64, linux) (push) Has been cancelled
release / build-and-upload (arm64, windows) (push) Has been cancelled
release / build-darwin (amd64, darwin) (push) Has been cancelled
release / checksums (push) Has been cancelled
release / finalize (push) Has been cancelled
release / build-darwin (arm64, darwin) (push) Has been cancelled
release / build-and-upload (amd64, linux) (push) Has been cancelled
release / build-and-upload (amd64, windows) (push) Has been cancelled
docs / deploy (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:34:16 +08:00

51 lines
1.3 KiB
Go

package main
import (
"os"
"path/filepath"
"strings"
"testing"
)
func TestReadFixtureFileErrorsWhenConfiguredAgentDirectoryMissing(t *testing.T) {
t.Setenv("FAKEAGENT_FIXTURE", t.TempDir())
dir := fixtureDir("opencode")
if dir != filepath.Join(os.Getenv("FAKEAGENT_FIXTURE"), "opencode") {
t.Fatalf("dir = %q, want joined agent fixture path", dir)
}
data, err := readFixtureFile(dir, "structured", ".jsonl")
if err == nil {
t.Fatal("expected error for missing configured agent fixture directory")
}
if data != nil {
t.Fatalf("data = %q, want nil", data)
}
if !strings.Contains(err.Error(), "missing fixture") {
t.Fatalf("error = %q, want missing fixture", err)
}
if !strings.Contains(err.Error(), "opencode") {
t.Fatalf("error = %q, want agent path detail", err)
}
}
func TestReadFixtureFileErrorsWhenConfiguredFixtureMissing(t *testing.T) {
t.Helper()
dir := t.TempDir()
data, err := readFixtureFile(dir, "structured", ".jsonl")
if err == nil {
t.Fatal("expected error for missing configured fixture")
}
if data != nil {
t.Fatalf("data = %q, want nil", data)
}
if !strings.Contains(err.Error(), "missing fixture") {
t.Fatalf("error = %q, want missing fixture", err)
}
if !strings.Contains(err.Error(), "structured") {
t.Fatalf("error = %q, want structured path detail", err)
}
}