MCPcopy Create free account
hub / github.com/JordanCoin/codemap / TestRunWatchSubcommandMessages

Function TestRunWatchSubcommandMessages

main_more_test.go:219–250  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

217}
218
219func TestRunWatchSubcommandMessages(t *testing.T) {
220 root := t.TempDir()
221
222 stdout, _ := captureMainStreams(t, func() { runWatchSubcommand("status", root) })
223 if !strings.Contains(stdout, "Watch daemon not running") {
224 t.Fatalf("expected not-running status, got:\n%s", stdout)
225 }
226
227 writeMainWatchState(t, root, watch.State{
228 UpdatedAt: time.Now(),
229 FileCount: 9,
230 Hubs: []string{"pkg/types.go"},
231 }, true)
232
233 stdout, _ = captureMainStreams(t, func() { runWatchSubcommand("start", root) })
234 if !strings.Contains(stdout, "Watch daemon already running") {
235 t.Fatalf("expected already-running start output, got:\n%s", stdout)
236 }
237
238 stdout, _ = captureMainStreams(t, func() { runWatchSubcommand("status", root) })
239 for _, check := range []string{"Watch daemon running", "Files: 9", "Hubs: 1"} {
240 if !strings.Contains(stdout, check) {
241 t.Fatalf("expected %q in output, got:\n%s", check, stdout)
242 }
243 }
244
245 watch.RemovePID(root)
246 stdout, _ = captureMainStreams(t, func() { runWatchSubcommand("stop", root) })
247 if !strings.Contains(stdout, "Watch daemon not running") {
248 t.Fatalf("expected stop to report not running, got:\n%s", stdout)
249 }
250}
251
252func TestRunHandoffSubcommandLatestVariantsMore(t *testing.T) {
253 root := t.TempDir()

Callers

nothing calls this directly

Calls 4

RemovePIDFunction · 0.92
captureMainStreamsFunction · 0.85
runWatchSubcommandFunction · 0.85
writeMainWatchStateFunction · 0.85

Tested by

no test coverage detected