mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 05:37:41 +00:00
test(tui): dedupe local bind loopback assertions
This commit is contained in:
@@ -84,20 +84,21 @@ describe("resolveGatewayConnection", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("uses loopback host when local bind is tailnet", () => {
|
it.each([
|
||||||
loadConfig.mockReturnValue({ gateway: { mode: "local", bind: "tailnet" } });
|
{
|
||||||
|
label: "tailnet",
|
||||||
|
bind: "tailnet",
|
||||||
|
setup: () => pickPrimaryTailnetIPv4.mockReturnValue("100.64.0.1"),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: "lan",
|
||||||
|
bind: "lan",
|
||||||
|
setup: () => pickPrimaryLanIPv4.mockReturnValue("192.168.1.42"),
|
||||||
|
},
|
||||||
|
])("uses loopback host when local bind is $label", ({ bind, setup }) => {
|
||||||
|
loadConfig.mockReturnValue({ gateway: { mode: "local", bind } });
|
||||||
resolveGatewayPort.mockReturnValue(18800);
|
resolveGatewayPort.mockReturnValue(18800);
|
||||||
pickPrimaryTailnetIPv4.mockReturnValue("100.64.0.1");
|
setup();
|
||||||
|
|
||||||
const result = resolveGatewayConnection({});
|
|
||||||
|
|
||||||
expect(result.url).toBe("ws://127.0.0.1:18800");
|
|
||||||
});
|
|
||||||
|
|
||||||
it("uses loopback host when local bind is lan", () => {
|
|
||||||
loadConfig.mockReturnValue({ gateway: { mode: "local", bind: "lan" } });
|
|
||||||
resolveGatewayPort.mockReturnValue(18800);
|
|
||||||
pickPrimaryLanIPv4.mockReturnValue("192.168.1.42");
|
|
||||||
|
|
||||||
const result = resolveGatewayConnection({});
|
const result = resolveGatewayConnection({});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user