Skip to content

Commit 386dd4e

Browse files
committed
test(gateway): replace redundant Windows passthrough test with platform-conditional guard test
The previous 'skips ::1 on Windows for non-loopback host passthrough' test used 0.0.0.0 as bindHost, which exits via the pre-existing non-loopback early-return before the win32 guard is ever reached. It would pass even if the Windows guard were removed entirely. Replace with a test that verifies the guard is win32-only: on darwin, resolveGatewayListenHosts('127.0.0.1') still returns ['127.0.0.1','::1'] and calls canBindToHost, confirming dual-stack is preserved on non-Windows.
1 parent 7ee9531 commit 386dd4e

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

src/gateway/net.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -331,12 +331,12 @@ describe("resolveGatewayListenHosts", () => {
331331
expect(canBindToHost).not.toHaveBeenCalled();
332332
});
333333

334-
it("skips ::1 on Windows for non-loopback host passthrough", async () => {
335-
vi.spyOn(process, "platform", "get").mockReturnValue("win32");
334+
it("still includes ::1 on non-Windows when IPv6 is bindable", async () => {
335+
vi.spyOn(process, "platform", "get").mockReturnValue("darwin");
336336
const canBindToHost = vi.fn().mockResolvedValue(true);
337-
const hosts = await resolveGatewayListenHosts("0.0.0.0", { canBindToHost });
338-
expect(hosts).toEqual(["0.0.0.0"]);
339-
expect(canBindToHost).not.toHaveBeenCalled();
337+
const hosts = await resolveGatewayListenHosts("127.0.0.1", { canBindToHost });
338+
expect(hosts).toEqual(["127.0.0.1", "::1"]);
339+
expect(canBindToHost).toHaveBeenCalledWith("::1");
340340
});
341341
});
342342

0 commit comments

Comments
 (0)