From 0b56472cf52c800a165e18705123568aaa389bf7 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sun, 15 Feb 2026 23:07:50 +0000 Subject: [PATCH] refactor(test): dedupe ios/android gateway client id tests --- src/gateway/server.ios-client-id.e2e.test.ts | 26 ++++---------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/src/gateway/server.ios-client-id.e2e.test.ts b/src/gateway/server.ios-client-id.e2e.test.ts index 37966798db7..2dfba6b42ce 100644 --- a/src/gateway/server.ios-client-id.e2e.test.ts +++ b/src/gateway/server.ios-client-id.e2e.test.ts @@ -61,30 +61,14 @@ function connectReq( ); } -test("accepts openclaw-ios as a valid gateway client id", async () => { +test.each([ + { clientId: "openclaw-ios", platform: "ios" }, + { clientId: "openclaw-android", platform: "android" }, +])("accepts $clientId as a valid gateway client id", async ({ clientId, platform }) => { const ws = new WebSocket(`ws://127.0.0.1:${port}`); await new Promise((resolve) => ws.once("open", resolve)); - const res = await connectReq(ws, { clientId: "openclaw-ios", platform: "ios" }); - // We don't care if auth fails here; we only care that schema validation accepts the client id. - // A schema rejection would close the socket before sending a response. - if (!res.ok) { - // allow unauthorized error when gateway requires auth - // but reject schema validation errors - const message = String(res.error?.message ?? ""); - if (message.includes("invalid connect params")) { - throw new Error(message); - } - } - - ws.close(); -}); - -test("accepts openclaw-android as a valid gateway client id", async () => { - const ws = new WebSocket(`ws://127.0.0.1:${port}`); - await new Promise((resolve) => ws.once("open", resolve)); - - const res = await connectReq(ws, { clientId: "openclaw-android", platform: "android" }); + const res = await connectReq(ws, { clientId, platform }); // We don't care if auth fails here; we only care that schema validation accepts the client id. // A schema rejection would close the socket before sending a response. if (!res.ok) {