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

Function TestWatcherStart

internal/prd/watcher_test.go:52–72  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

50}
51
52func TestWatcherStart(t *testing.T) {
53 tmpDir := t.TempDir()
54 prdPath := createTestPRDMd(t, tmpDir, []UserStory{
55 {ID: "US-001", Title: "Test Story", Passes: false},
56 })
57
58 watcher, err := NewWatcher(prdPath)
59 if err != nil {
60 t.Fatalf("Failed to create watcher: %v", err)
61 }
62 defer watcher.Stop()
63
64 if err := watcher.Start(); err != nil {
65 t.Fatalf("Failed to start watcher: %v", err)
66 }
67
68 // Starting again should return an error
69 if err := watcher.Start(); err == nil {
70 t.Error("Expected error when starting watcher twice")
71 }
72}
73
74func TestWatcherDetectsFileChange(t *testing.T) {
75 tmpDir := t.TempDir()

Callers

nothing calls this directly

Calls 4

StopMethod · 0.95
StartMethod · 0.95
createTestPRDMdFunction · 0.85
NewWatcherFunction · 0.85

Tested by

no test coverage detected