mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 04:50:44 +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", () => {
|
||||
loadConfig.mockReturnValue({ gateway: { mode: "local", bind: "tailnet" } });
|
||||
it.each([
|
||||
{
|
||||
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);
|
||||
pickPrimaryTailnetIPv4.mockReturnValue("100.64.0.1");
|
||||
|
||||
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");
|
||||
setup();
|
||||
|
||||
const result = resolveGatewayConnection({});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user