| 1 | import { isLoopbackHost } from "@/Local/DockerHostGateway"; |
| 2 | import { describe, expect, it } from "alchemy-test"; |
| 3 | |
| 4 | describe("Docker loopback hosts", { tags: ["unit", "local"] }, () => { |
| 5 | it("recognizes loopback and localhost-looking hosts", () => { |
| 6 | expect(isLoopbackHost("127.0.0.1")).toBe(true); |
| 7 | expect(isLoopbackHost("localhost")).toBe(true); |
| 8 | expect(isLoopbackHost("host.docker.localhost")).toBe(true); |
| 9 | expect(isLoopbackHost("db.example.com")).toBe(false); |
| 10 | expect( |
| 11 | isLoopbackHost("ep-cool-name-123456-pooler.us-east-1.aws.neon.tech"), |
| 12 | ).toBe(false); |
| 13 | expect(isLoopbackHost("xxxx.pg.psdb.cloud")).toBe(false); |
| 14 | expect(isLoopbackHost("aws.connect.psdb.cloud")).toBe(false); |
| 15 | }); |
| 16 | }); |