mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-06 05:51:15 +08:00
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
41 lines
1.1 KiB
TypeScript
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",
|
|
});
|
|
});
|
|
});
|