MCPcopy Create free account
hub / github.com/MiniCodeMonkey/chief / TestRunEditRequiresProvider

Function TestRunEditRequiresProvider

internal/cmd/edit_test.go:87–110  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

85}
86
87func TestRunEditRequiresProvider(t *testing.T) {
88 tmpDir := t.TempDir()
89 prdDir := filepath.Join(tmpDir, ".chief", "prds", "main")
90 if err := os.MkdirAll(prdDir, 0755); err != nil {
91 t.Fatalf("Failed to create directory: %v", err)
92 }
93 prdMdPath := filepath.Join(prdDir, "prd.md")
94 if err := os.WriteFile(prdMdPath, []byte("# Main PRD"), 0644); err != nil {
95 t.Fatalf("Failed to create prd.md: %v", err)
96 }
97
98 opts := EditOptions{
99 Name: "main",
100 BaseDir: tmpDir,
101 }
102
103 err := RunEdit(opts)
104 if err == nil {
105 t.Fatal("expected provider validation error")
106 }
107 if !contains(err.Error(), "Provider") {
108 t.Fatalf("expected error to mention Provider, got: %v", err)
109 }
110}
111
112// Helper function to check if a string contains a substring
113func contains(s, substr string) bool {

Callers

nothing calls this directly

Calls 2

RunEditFunction · 0.85
containsFunction · 0.70

Tested by

no test coverage detected