Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

endpoint.test.ts

12 lines599 Bytes

1import { describe, expect, it } from "vite-plus/test";
2​
3import { deriveWsBaseUrl, normalizeHttpBaseUrl } from "./endpoint.ts";
4​
5describe("advertised endpoint helpers", () => {
6 it("normalizes HTTP and WebSocket base URLs", () => {
7 expect(normalizeHttpBaseUrl("https://example.com/path?x=1#hash")).toBe("https://example.com/");
8 expect(normalizeHttpBaseUrl("wss://example.com/socket")).toBe("https://example.com/");
9 expect(deriveWsBaseUrl("https://example.com/api")).toBe("wss://example.com/");
10 expect(deriveWsBaseUrl("http://127.0.0.1:3773")).toBe("ws://127.0.0.1:3773/");
11 });
12});