(t *testing.T)
| 174 | } |
| 175 | |
| 176 | func TestWaitForDaemonState(t *testing.T) { |
| 177 | root := t.TempDir() |
| 178 | done := make(chan struct{}) |
| 179 | go func() { |
| 180 | defer close(done) |
| 181 | time.Sleep(150 * time.Millisecond) |
| 182 | _ = os.MkdirAll(filepath.Join(root, ".codemap"), 0o755) |
| 183 | data, _ := json.Marshal(watch.State{ |
| 184 | UpdatedAt: time.Now(), |
| 185 | FileCount: 7, |
| 186 | }) |
| 187 | _ = os.WriteFile(filepath.Join(root, ".codemap", "state.json"), data, 0o644) |
| 188 | }() |
| 189 | |
| 190 | state := waitForDaemonState(root, time.Second) |
| 191 | <-done |
| 192 | if state == nil { |
| 193 | t.Fatal("expected state before timeout") |
| 194 | } |
| 195 | if state.FileCount != 7 { |
| 196 | t.Fatalf("expected file count 7, got %d", state.FileCount) |
| 197 | } |
| 198 | } |
| 199 | |
| 200 | func TestGetRecentHandoffAndBranchDetection(t *testing.T) { |
| 201 | if _, err := exec.LookPath("git"); err != nil { |
nothing calls this directly
no test coverage detected