MCPcopy Index your code
hub / github.com/codehamr/codehamr / TestCheckReportsStale

Function TestCheckReportsStale

internal/update/update_test.go:371–385  ·  view source on GitHub ↗

TestCheckReportsStale: published hash differs from local → Check returns true (update available), driving the maybeSelfUpdate trigger.

(t *testing.T)

Source from the content-addressed store, hash-verified

369// TestCheckReportsStale: published hash differs from local → Check returns
370// true (update available), driving the maybeSelfUpdate trigger.
371func 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

Callers

nothing calls this directly

Calls 5

platformAssetFunction · 0.85
newFakeReleaseFunction · 0.85
hashOfFunction · 0.85
withReleaseURLsFunction · 0.85
CheckFunction · 0.85

Tested by

no test coverage detected