@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

main
ts 24 lines 914 Bytes
Raw
1 import { afterEach, describe, expect, it, vi } from "vite-plus/test";
2
3 import { resolveDesktopPairingUrl, resolveHostedPairingUrl } from "./pairingUrls";
4
5 describe("settings pairing URL helpers", () => {
6 afterEach(() => {
7 vi.unstubAllEnvs();
8 });
9
10 it("uses direct backend pairing URLs for HTTP endpoints", () => {
11 expect(resolveHostedPairingUrl("http://192.168.1.44:3773", "PAIRCODE")).toBeNull();
12 expect(resolveDesktopPairingUrl("http://192.168.1.44:3773", "PAIRCODE")).toBe(
13 "http://192.168.1.44:3773/pair#token=PAIRCODE",
14 );
15 });
16
17 it("uses hosted pairing URLs for HTTPS endpoints", () => {
18 vi.stubEnv("VITE_HOSTED_APP_URL", "https://preview.t3.codes");
19
20 expect(resolveHostedPairingUrl("https://host.tailnet.example.ts.net:3773", "PAIRCODE")).toBe(
21 "https://preview.t3.codes/pair?host=https%3A%2F%2Fhost.tailnet.example.ts.net%3A3773#token=PAIRCODE",
22 );
23 });
24 });