MCPcopy Create free account
hub / github.com/0xUnixIO/pulse / TestClient_Status_HubSuccess

Function TestClient_Status_HubSuccess

internal/nodes/client_hub_test.go:25–39  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

23}
24
25func TestClient_Status_HubSuccess(t *testing.T) {
26 mh := &mockHub{resp: json.RawMessage(`{"running":true}`)}
27 c := NewClientWithHub("node-1", mh)
28
29 st, err := c.Status(context.Background())
30 if err != nil {
31 t.Fatalf("unexpected error: %v", err)
32 }
33 if !st.Running {
34 t.Fatalf("expected running=true, got %+v", st)
35 }
36 if mh.lastNodeID != "node-1" || mh.lastMethod != "Status" {
37 t.Fatalf("unexpected hub call: id=%q method=%q", mh.lastNodeID, mh.lastMethod)
38 }
39}
40
41func TestClient_HubOffline_UsesSentinel(t *testing.T) {
42 // 模拟一个未注册的 hub-离线错误:使用错误消息匹配兜底路径。

Callers

nothing calls this directly

Calls 2

NewClientWithHubFunction · 0.85
StatusMethod · 0.65

Tested by

no test coverage detected