























@@ -104,10 +104,12 @@ describe("probeGatewayStatus", () => {
104104json: true,
105105});
106106107-expect(result).toMatchObject({
108-ok: true,
109-server: { version: "2026.5.6", connId: "conn-1" },
110-});
107+expect(result.ok).toBe(true);
108+if (!result.ok || !("server" in result)) {
109+throw new Error("expected successful probe with server details");
110+}
111+expect(result.server?.version).toBe("2026.5.6");
112+expect(result.server?.connId).toBe("conn-1");
111113});
112114113115it("uses a real status RPC when requireRpc is enabled", async () => {
@@ -187,18 +189,10 @@ describe("probeGatewayStatus", () => {
187189requireRpc: true,
188190});
189191190-expect(probeGatewayMock).toHaveBeenCalledWith(
191-expect.objectContaining({
192-preauthHandshakeTimeoutMs: 30_000,
193-timeoutMs: 30_000,
194-}),
195-);
196-expect(callGatewayMock).toHaveBeenCalledWith(
197-expect.objectContaining({
198- config,
199-timeoutMs: 30_000,
200-}),
201-);
192+expect(probeGatewayMock.mock.calls[0]?.[0]?.preauthHandshakeTimeoutMs).toBe(30_000);
193+expect(probeGatewayMock.mock.calls[0]?.[0]?.timeoutMs).toBe(30_000);
194+expect(callGatewayMock.mock.calls[0]?.[0]?.config).toBe(config);
195+expect(callGatewayMock.mock.calls[0]?.[0]?.timeoutMs).toBe(30_000);
202196});
203197204198it("falls back to read-only when the status RPC succeeds but the auth probe is inconclusive", async () => {
@@ -273,11 +267,9 @@ describe("probeGatewayStatus", () => {
273267timeoutMs: 5_000,
274268});
275269276-expect(result).toMatchObject({
277-ok: false,
278-kind: "connect",
279-error: "scope upgrade pending approval (requestId: req-123)",
280-});
270+expect(result.ok).toBe(false);
271+expect(result.kind).toBe("connect");
272+expect(result.error).toBe("scope upgrade pending approval (requestId: req-123)");
281273});
282274283275it("surfaces status RPC errors when requireRpc is enabled", async () => {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。