Open History to see the last commit
1import { describe, expect, it } from "vite-plus/test";
2
3import { parseActiveThreadPath } from "./hardwareKeyboardCommands";
4
5describe("parseActiveThreadPath", () => {
6 it("extracts the active thread from thread subroutes", () => {
7 expect(parseActiveThreadPath("/threads/environment-1/thread-1/files/src/index.ts")).toEqual({
8 environmentId: "environment-1",
9 threadId: "thread-1",
10 });
11 });
12
13 it("decodes route components", () => {
14 expect(parseActiveThreadPath("/threads/local%20machine/thread%2Fone/review")).toEqual({
15 environmentId: "local machine",
16 threadId: "thread/one",
17 });
18 });
19
20 it("ignores non-thread routes", () => {
21 expect(parseActiveThreadPath("/settings")).toBeNull();
22 expect(parseActiveThreadPath("/threads/environment-only")).toBeNull();
23 });
24
25 it("ignores malformed encoded route components", () => {
26 expect(parseActiveThreadPath("/threads/%E0%A4%A/thread-1")).toBeNull();
27 });
28});