Files
openclaw/src/commands/gateway-presence.test.ts
Gio Della-Libera b3eba2ff38 fix(gateway): dedupe probe warnings by gateway identity (#85791)
Merged via squash.

Prepared head SHA: 13e3c00f56
Co-authored-by: giodl73-repo <235387111+giodl73-repo@users.noreply.github.com>
Co-authored-by: giodl_microsoft <115749436+giodl_microsoft@users.noreply.github.com>
Reviewed-by: @giodl_microsoft
2026-06-05 10:23:12 -07:00

41 lines
1.1 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { pickGatewaySelfPresence } from "./gateway-presence.js";
describe("pickGatewaySelfPresence", () => {
it("extracts host and ip from legacy gateway self text", () => {
expect(
pickGatewaySelfPresence([
{
text: "Gateway: gateway-host (192.0.2.10) · app 2026.5.22 · mode gateway · reason self",
},
]),
).toStrictEqual({
host: "gateway-host",
ip: "192.0.2.10",
version: undefined,
platform: undefined,
});
});
it("prefers structured gateway self fields over legacy text", () => {
expect(
pickGatewaySelfPresence([
{
text: "Gateway: legacy-host (192.0.2.10) · app 2026.5.22 · mode gateway · reason self",
host: "structured-host",
ip: "192.0.2.11",
version: "2026.5.23",
platform: "linux",
mode: "gateway",
reason: "self",
},
]),
).toStrictEqual({
host: "structured-host",
ip: "192.0.2.11",
version: "2026.5.23",
platform: "linux",
});
});
});