(t *testing.T)
| 23 | } |
| 24 | |
| 25 | func 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 | |
| 41 | func TestClient_HubOffline_UsesSentinel(t *testing.T) { |
| 42 | // 模拟一个未注册的 hub-离线错误:使用错误消息匹配兜底路径。 |
nothing calls this directly
no test coverage detected