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
| 1 | import type { BrowserLinkTarget } from "@t3tools/contracts"; |
| 2 | import { describe, expect, it, vi } from "vite-plus/test"; |
| 3 | |
| 4 | import { resolveLinkTarget } from "./browserLinkTarget"; |
| 5 | |
| 6 | const settings = vi.hoisted(() => ({ browserLinkTarget: "system" as BrowserLinkTarget })); |
| 7 | |
| 8 | vi.mock("~/hooks/useSettings", () => ({ |
| 9 | ensureClientSettingsHydrated: vi.fn(async () => undefined), |
| 10 | getClientSettings: () => settings, |
| 11 | })); |
| 12 | |
| 13 | const click = { metaKey: false, ctrlKey: false }; |
| 14 | |
| 15 | describe("resolveLinkTarget", () => { |
| 16 | it("leaves non-web schemes to the shell", () => { |
| 17 | for (const url of ["mailto:someone@example.com", "vscode://file/x", "not a url"]) { |
| 18 | expect(resolveLinkTarget({ url, event: click, preference: "app", canOpenInApp: true })).toBe( |
| 19 | "system", |
| 20 | ); |
| 21 | } |
| 22 | }); |
| 23 | }); |