TestCheckReportsStale: published hash differs from local → Check returns true (update available), driving the maybeSelfUpdate trigger.
(t *testing.T)
| 369 | // TestCheckReportsStale: published hash differs from local → Check returns |
| 370 | // true (update available), driving the maybeSelfUpdate trigger. |
| 371 | func TestCheckReportsStale(t *testing.T) { |
| 372 | asset := platformAsset(t) |
| 373 | tmpDir := t.TempDir() |
| 374 | exec := filepath.Join(tmpDir, "codehamr") |
| 375 | if err := os.WriteFile(exec, []byte("local v1\n"), 0o755); err != nil { |
| 376 | t.Fatal(err) |
| 377 | } |
| 378 | r := newFakeRelease(t, asset, []byte("remote v2\n"), hashOf([]byte("remote v2\n"))) |
| 379 | withReleaseURLs(t, r.srv.URL) |
| 380 | t.Setenv("CODEHAMR_NO_UPDATE_CHECK", "") |
| 381 | |
| 382 | if !Check(context.Background(), exec) { |
| 383 | t.Fatal("Check should return true when local hash differs from published") |
| 384 | } |
| 385 | } |
| 386 | |
| 387 | // TestApplyKeepsPreviousBinaryAsOld is the cross-platform-parity guard: Apply |
| 388 | // must rename execPath aside to execPath+".old" before moving the new download |
nothing calls this directly
no test coverage detected