mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-14 18:10:39 +09:00
36 lines
1 KiB
TypeScript
36 lines
1 KiB
TypeScript
|
|
import { describe, expect, it } from "vitest";
|
||
|
|
import { resolveRuntimeBind, validateConfiguredBindMode } from "@paperclipai/shared";
|
||
|
|
|
||
|
|
describe("network bind helpers", () => {
|
||
|
|
it("rejects non-loopback bind modes in local_trusted", () => {
|
||
|
|
expect(
|
||
|
|
validateConfiguredBindMode({
|
||
|
|
deploymentMode: "local_trusted",
|
||
|
|
deploymentExposure: "private",
|
||
|
|
bind: "lan",
|
||
|
|
host: "0.0.0.0",
|
||
|
|
}),
|
||
|
|
).toContain("local_trusted requires server.bind=loopback");
|
||
|
|
});
|
||
|
|
|
||
|
|
it("resolves tailnet bind using the detected tailscale address", () => {
|
||
|
|
const resolved = resolveRuntimeBind({
|
||
|
|
bind: "tailnet",
|
||
|
|
host: "127.0.0.1",
|
||
|
|
tailnetBindHost: "100.64.0.8",
|
||
|
|
});
|
||
|
|
|
||
|
|
expect(resolved.errors).toEqual([]);
|
||
|
|
expect(resolved.host).toBe("100.64.0.8");
|
||
|
|
});
|
||
|
|
|
||
|
|
it("requires a custom bind host when bind=custom", () => {
|
||
|
|
const resolved = resolveRuntimeBind({
|
||
|
|
bind: "custom",
|
||
|
|
host: "127.0.0.1",
|
||
|
|
});
|
||
|
|
|
||
|
|
expect(resolved.errors).toContain("server.customBindHost is required when server.bind=custom");
|
||
|
|
});
|
||
|
|
});
|