test: dedupe repeated validation and throw assertions

This commit is contained in:
Peter Steinberger
2026-02-21 23:21:35 +00:00
parent 01ec832f78
commit 98790339ef
4 changed files with 49 additions and 26 deletions

View File

@@ -333,9 +333,16 @@ describe("buildGatewayConnectionDetails", () => {
resolveGatewayPort.mockReturnValue(18789);
pickPrimaryTailnetIPv4.mockReturnValue(undefined);
expect(() => buildGatewayConnectionDetails()).toThrow("SECURITY ERROR");
expect(() => buildGatewayConnectionDetails()).toThrow("plaintext ws://");
expect(() => buildGatewayConnectionDetails()).toThrow("wss://");
let thrown: unknown;
try {
buildGatewayConnectionDetails();
} catch (error) {
thrown = error;
}
expect(thrown).toBeInstanceOf(Error);
expect((thrown as Error).message).toContain("SECURITY ERROR");
expect((thrown as Error).message).toContain("plaintext ws://");
expect((thrown as Error).message).toContain("wss://");
});
it("allows ws:// for loopback addresses in local mode", () => {