Buckets:
| import { describe, expect, test } from "bun:test" | |
| import { terminalWebSocketURL } from "./terminal-websocket-url" | |
| describe("terminalWebSocketURL", () => { | |
| test("uses query auth without embedding credentials in websocket URL", () => { | |
| const url = terminalWebSocketURL({ | |
| url: "http://127.0.0.1:49365", | |
| id: "pty_test", | |
| directory: "/tmp/project", | |
| cursor: 0, | |
| sameOrigin: false, | |
| username: "opencode", | |
| password: "secret", | |
| }) | |
| expect(url.protocol).toBe("ws:") | |
| expect(url.username).toBe("") | |
| expect(url.password).toBe("") | |
| expect(url.searchParams.get("auth_token")).toBe(btoa("opencode:secret")) | |
| }) | |
| test("omits query auth for same-origin saved credentials", () => { | |
| const url = terminalWebSocketURL({ | |
| url: "https://app.example.test", | |
| id: "pty_test", | |
| directory: "/tmp/project", | |
| cursor: 10, | |
| sameOrigin: true, | |
| username: "opencode", | |
| password: "secret", | |
| }) | |
| expect(url.protocol).toBe("wss:") | |
| expect(url.searchParams.has("auth_token")).toBe(false) | |
| }) | |
| test("uses query auth for same-origin credentials from auth_token", () => { | |
| const url = terminalWebSocketURL({ | |
| url: "https://app.example.test", | |
| id: "pty_test", | |
| directory: "/tmp/project", | |
| cursor: 10, | |
| sameOrigin: true, | |
| username: "opencode", | |
| password: "secret", | |
| authToken: true, | |
| }) | |
| expect(url.protocol).toBe("wss:") | |
| expect(url.searchParams.get("auth_token")).toBe(btoa("opencode:secret")) | |
| }) | |
| }) | |
Xet Storage Details
- Size:
- 1.53 kB
- Xet hash:
- f61e2796c5042bfca2ad02c8731e1c024df451ea47cf677c755d1af1afad0477
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.