MCPcopy Index your code
hub / github.com/coder/coder / TestScanNoHeartbeatWithoutSubscribedRoots

Function TestScanNoHeartbeatWithoutSubscribedRoots

agent/agentgit/agentgit_test.go:315–323  ·  view source on GitHub ↗

TestScanNoHeartbeatWithoutSubscribedRoots pins that the heartbeat only fires when there is at least one subscribed repo. Before any subscribe call, Scan() must still short-circuit to nil so the WebSocket handler does not spam empty messages to a client that has not registered any paths yet.

(t *testing.T)

Source from the content-addressed store, hash-verified

313// WebSocket handler does not spam empty messages to a client that
314// has not registered any paths yet.
315func TestScanNoHeartbeatWithoutSubscribedRoots(t *testing.T) {
316 t.Parallel()
317
318 logger := slogtest.Make(t, nil)
319 h := agentgit.NewHandler(logger)
320
321 msg := h.Scan(context.Background())
322 require.Nil(t, msg, "no subscribed roots should mean no heartbeat")
323}
324
325func TestScanDeltaDetectsContentChanges(t *testing.T) {
326 t.Parallel()

Callers

nothing calls this directly

Calls 2

ScanMethod · 0.95
NewHandlerFunction · 0.92

Tested by

no test coverage detected