42 lines · 1.3 KB · TypeScript
RawDownload
import { describe, expect, it, vi } from "vite-plus/test"; import { mobileAuthClientMetadata, redactPairingCredential } from "./connection"; vi.mock("./runtime", () => ({  mobileRemoteHttpRuntime: {    runPromise: vi.fn(),  },})); vi.mock("react-native", () => ({  Platform: {    OS: "ios",  },})); describe("mobile remote connection records", () => {  it("identifies mobile token exchanges for authorized-client presentation", () => {    expect(mobileAuthClientMetadata()).toEqual({      label: "T3 Code Mobile",      deviceType: "mobile",      os: "iOS",    });  });   it("removes one-time bootstrap credentials before persisting pairing URLs", () => {    expect(redactPairingCredential("https://desktop.example/#token=bootstrap-token")).toBe(      "https://desktop.example/",    );    expect(redactPairingCredential("https://desktop.example/?token=bootstrap-token")).toBe(      "https://desktop.example/",    );  });   it("removes hosted pairing credentials while keeping the advertised host", () => {    expect(      redactPairingCredential(        "https://app.t3.codes/pair?host=https%3A%2F%2Fdesktop.example&token=bootstrap-token&label=Desktop",      ),    ).toBe("https://app.t3.codes/pair?host=https%3A%2F%2Fdesktop.example&label=Desktop");  });});

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t