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 22, 20:45 UTC
test(mobile): prune low-value tests in mobile (second pass) (#22588)
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Julius Marminge committed
Oct 20, 2026 at 18:30 UTC
7c16a4008a2750ed043031997a67aae15da37802
78 files changed
+70
-1918
apps/mobile/plugins/withAndroidFbjniVersion.test.mjs
+1
@@ -86,6 +86,7 @@ describe("withAndroidFbjniVersion", () => {
86
expect(twice).toBe(once);
87
});
88
89
+ // regression: #20118 fresh Android builds no longer crash on launch
90
it("writes Kotlin syntax into a Kotlin build script", async () => {
91
const result = await prebuildRootGradle("build.gradle.kts", "plugins {}\n");
92
apps/mobile/src/components/ui/headerMenu.test.ts
deleted
-36
@@ -1,36 +0,0 @@
1
-import { describe, expect, it } from "vite-plus/test";
2
-import { splitAndroidHeaderActions } from "./headerMenu.android";
3
-
4
-describe("header menus", () => {
5
- it("keeps overflow-only Android header actions in the overflow menu", () => {
6
- const action = (accessibilityLabel: string, overflowOnly?: boolean) => ({
7
- accessibilityLabel,
8
- icon: "trash" as const,
9
- onPress: () => {},
10
- overflowOnly,
11
- });
12
- const labels = (
13
- split: ReturnType<typeof splitAndroidHeaderActions<ReturnType<typeof action>>>,
14
- ) => ({
15
- visible: split.visibleActions.map((item) => item.accessibilityLabel),
16
- overflow: split.overflowActions.map((item) => item.accessibilityLabel),
17
- });
18
- const open = action("Open");
19
- const remove = action("Delete", true);
20
- expect(labels(splitAndroidHeaderActions([open, action("Comment")], false))).toEqual({
21
- visible: ["Open", "Comment"],
22
- overflow: [],
23
- });
24
- expect(labels(splitAndroidHeaderActions([open, remove], true))).toEqual({
25
- visible: ["Open"],
26
- overflow: ["Delete"],
27
- });
28
- expect(labels(splitAndroidHeaderActions([remove], true))).toEqual({
29
- visible: [],
30
- overflow: ["Delete"],
31
- });
32
- expect(
33
- labels(splitAndroidHeaderActions([action("Review"), action("Comment"), open, remove], true)),
34
- ).toEqual({ visible: ["Review", "Comment", "Open"], overflow: ["Delete"] });
35
- });
36
-});
apps/mobile/src/connection/environment-cache-store.test.ts
-32
@@ -11,7 +11,6 @@ import {
11
type OrchestrationV2ShellSnapshot,
12
type OrchestrationV2ThreadDetailSnapshot,
13
type ThreadPullRequestLink,
14
- type VcsListRefsResult,
14
} from "@t3tools/contracts";
15
import { describe, expect, it } from "@effect/vitest";
16
import * as DateTime from "effect/DateTime";
@@ -144,20 +143,6 @@ const THREAD_SNAPSHOT: OrchestrationV2ThreadDetailSnapshot = {
143
updatedAt: NOW,
144
},
145
};
147
-const REFS: VcsListRefsResult = {
148
- refs: [
149
- {
150
- name: "main",
151
- current: true,
152
- isDefault: true,
153
- worktreePath: "/repo",
154
- },
155
- ],
156
- isRepo: true,
157
- hasPrimaryRemote: true,
158
- nextCursor: null,
159
- totalCount: 1,
160
-};
146
147
function cacheId(
148
environmentId: EnvironmentId,
@@ -334,21 +319,4 @@ describe("mobile SQLite environment cache store", () => {
319
expect(memory.removed).toEqual([id]);
320
}),
321
);
337
-
338
- it.effect("clears one environment without touching another", () =>
339
- Effect.gen(function* () {
340
- const memory = makeDatabase();
341
- const store = yield* make().pipe(
342
- Effect.provideService(MobileDatabase.MobileDatabase, memory.database),
343
- );
344
- const otherEnvironmentId = EnvironmentId.make("environment-2");
345
- yield* store.saveVcsRefs(ENVIRONMENT_ID, "/repo", REFS);
346
- yield* store.saveVcsRefs(otherEnvironmentId, "/repo", REFS);
347
-
348
- yield* store.clear(ENVIRONMENT_ID);
349
-
350
- expect(yield* store.loadVcsRefs(ENVIRONMENT_ID, "/repo")).toEqual(Option.none());
351
- expect(yield* store.loadVcsRefs(otherEnvironmentId, "/repo")).toEqual(Option.some(REFS));
352
- }),
353
- );
322
});
apps/mobile/src/features/agent-awareness/notificationNavigation.test.ts
-32
@@ -26,28 +26,6 @@ afterEach(() => {
26
});
27
28
describe("consumeLastAgentNotificationResponse", () => {
29
- it("routes a response before reporting a clear failure", async () => {
30
- const cause = new Error("notification clear unavailable");
31
- const consoleError = vi.spyOn(console, "error").mockImplementation(() => undefined);
32
- const response = responseWithData({}, "notification-clear") as NotificationResponse;
33
- const handleResponse = vi.fn();
34
-
35
- await consumeLastAgentNotificationResponse({
36
- getLastResponse: () => Promise.resolve(response),
37
- clearLastResponse: () => Promise.reject(cause),
38
- handleResponse,
39
- });
40
-
41
- expect(handleResponse).toHaveBeenCalledWith(response);
42
- expect(consoleError).toHaveBeenCalledWith(
43
- expect.objectContaining({
44
- _tag: "NotificationNavigationError",
45
- operation: "clear",
46
- notificationId: "notification-clear",
47
- }),
48
- );
49
- });
50
-
29
it("reports routing failures before clearing the response", async () => {
30
const cause = new Error("notification routing unavailable");
31
const consoleError = vi.spyOn(console, "error").mockImplementation(() => undefined);
@@ -86,16 +64,6 @@ describe("extractAgentNotificationDeepLink", () => {
64
).toBe("/threads/env/thread");
65
});
66
89
- it("normalizes explicit thread deep links from APNs payload data", () => {
90
- expect(
91
- extractAgentNotificationDeepLink(
92
- responseWithData({
93
- deepLink: "/threads/env%201/thread%2F2",
94
- }),
95
- ),
96
- ).toBe("/threads/env%201/thread%2F2");
97
- });
98
-
67
it("falls back to the thread route from environment and thread ids", () => {
68
expect(
69
extractAgentNotificationDeepLink(
apps/mobile/src/features/agent-awareness/notificationPermissions.test.ts
deleted
-35
@@ -1,35 +0,0 @@
1
-import { beforeEach, vi } from "vite-plus/test";
2
-import { describe, expect, it } from "@effect/vitest";
3
-import * as Effect from "effect/Effect";
4
-import * as Notifications from "expo-notifications";
5
-import { requestAgentNotificationPermission } from "./notificationPermissions";
6
-
7
-const platform = vi.hoisted(() => ({ OS: "android" }));
8
-vi.mock("react-native", () => ({ Platform: platform }));
9
-vi.mock("expo-notifications", () => ({
10
- AndroidImportance: { HIGH: 4 },
11
- setNotificationChannelAsync: vi.fn(() => Promise.resolve(null)),
12
- getPermissionsAsync: vi.fn(() => Promise.resolve({ granted: false, canAskAgain: true })),
13
- requestPermissionsAsync: vi.fn(() => Promise.resolve({ granted: true, canAskAgain: true })),
14
-}));
15
-
16
-describe("agent notification permission", () => {
17
- beforeEach(() => {
18
- vi.clearAllMocks();
19
- platform.OS = "android";
20
- });
21
-
22
- it.effect("preserves denied permission when Android cannot ask again", () =>
23
- Effect.gen(function* () {
24
- vi.mocked(Notifications.getPermissionsAsync).mockResolvedValueOnce({
25
- granted: false,
26
- canAskAgain: false,
27
- } as Notifications.NotificationPermissionsStatus);
28
- expect(yield* requestAgentNotificationPermission).toEqual({
29
- type: "denied",
30
- canAskAgain: false,
31
- });
32
- expect(Notifications.requestPermissionsAsync).not.toHaveBeenCalled();
33
- }),
34
- );
35
-});
apps/mobile/src/features/agent-awareness/remoteRegistration.test.ts
-15
@@ -598,21 +598,6 @@ describe("makeRelayDeviceRegistrationRequest", () => {
598
}).pipe(Effect.provide(layerRelayTest));
599
});
600
601
- it.effect("re-registers when the stored account identity differs", () => {
602
- Constants.expoConfig!.extra = {
603
- relay: {
604
- url: "https://relay.example.test/",
605
- },
606
- };
607
- registrationRecordStore.current = { identity: "someone-else", signature: "stale" };
608
- setAgentAwarenessRelayTokenProvider(() => Promise.resolve("clerk-token-user-a"));
609
-
610
- return Effect.gen(function* () {
611
- yield* refreshAgentAwarenessRegistration();
612
- expect(saveAgentAwarenessRegistrationRecord).toHaveBeenCalledTimes(1);
613
- }).pipe(Effect.provide(layerRelayTest));
614
- });
615
-
601
it.effect("continues queued device registration after a failed auth lookup", () => {
602
Constants.expoConfig!.extra = {
603
relay: {
apps/mobile/src/features/connection/environmentSections.test.ts
-17
@@ -79,23 +79,6 @@ describe("mobile environment settings sections", () => {
79
expect(sections.availableCloudEnvironments).toEqual([]);
80
});
81
82
- it("does not duplicate a saved relay environment in the available cloud listing", () => {
83
- const cloud = connectedEnvironment({
84
- environmentId: "environment-cloud",
85
- isRelayManaged: true,
86
- connectionState: "available",
87
- });
88
- const listedCloud = cloudEnvironment("environment-cloud");
89
-
90
- const sections = splitEnvironmentSections({
91
- connectedEnvironments: [cloud],
92
- cloudEnvironments: [listedCloud],
93
- });
94
-
95
- expect(sections.connectedCloudEnvironments).toEqual([cloud]);
96
- expect(sections.availableCloudEnvironments).toEqual([]);
97
- });
98
-
82
it("still offers a cloud environment saved directly as a local backend", () => {
83
const local = connectedEnvironment({
84
environmentId: "environment-cloud",
apps/mobile/src/features/diagnostics/crash-log-model.test.ts
-8
@@ -44,12 +44,4 @@ describe("parseStartupCrashRecords", () => {
44
]);
45
expect(records.map((record) => record.timestamp)).toEqual([20, 10]);
46
});
47
-
48
- it("skips a runtime error entry without a description line", () => {
49
- expect(
50
- parseStartupCrashRecords([
51
- { ...FATAL, message: "ErrorRecovery fatal exception: Fatal exception: Name: x" },
52
- ]),
53
- ).toEqual([]);
54
- });
47
});
apps/mobile/src/features/home/useThreadListActions.test.ts
+5
-18
@@ -219,24 +219,6 @@ describe("thread list operation permissions", () => {
219
expect(state.requests).toEqual([]);
220
});
221
222
- it.each(mutationCases)(
223
- "%s works when the target environment gains only task permission",
224
- async (handler, action) => {
225
- state.scopes.get(primaryEnvironmentId)!.clear();
226
- const actions = useThreadListActions();
227
- state.scopes.get(otherEnvironmentId)!.add(AuthOrchestrationOperateScope);
228
-
229
- await actions[handler](
230
- makeThread({ environmentId: otherEnvironmentId }),
231
- "2099-01-01T00:00:00.000Z",
232
- );
233
-
234
- expect(state.requests).toEqual([
235
- expect.objectContaining({ action, environmentId: otherEnvironmentId }),
236
- ]);
237
- },
238
- );
239
-
222
it("rechecks permission after a retained delete confirmation", async () => {
223
useThreadListActions().confirmDeleteThread(makeThread());
224
const confirm = state.dialogs[0]?.onConfirm;
@@ -368,6 +350,7 @@ describe("thread action undo", () => {
350
expect(readThreadUndoNotice()).toBeNull();
351
});
352
353
+ // regression: #21401 restore archive and thread action undo
354
it("wakes a snoozed thread through the undo action", async () => {
355
const thread = makeThread();
356
await useThreadListActions().snoozeThread(thread, "2099-01-01T09:00:00.000Z");
@@ -410,6 +393,7 @@ describe("thread action undo", () => {
393
},
394
);
395
396
+ // regression: #21401 restore archive and thread action undo
397
it("does not restore snooze if undoing an unpin fails", async () => {
398
const thread = makeThread({
399
pinnedAt: "2026-09-02T00:00:00.000Z",
@@ -431,6 +415,7 @@ describe("thread action undo", () => {
415
expect(readThreadUndoNotice()).toBeNull();
416
});
417
418
+ // regression: #21401 restore archive and thread action undo
419
it("does not offer undo for a failed action", async () => {
420
state.failedAction = "settle";
421
expect(await useThreadListActions().settleThread(makeThread())).toBe(false);
@@ -456,6 +441,7 @@ describe("thread action undo", () => {
441
expect(state.requests.map(({ action }) => action)).toEqual(["unpin"]);
442
});
443
444
+ // regression: #21401 restore archive and thread action undo
445
it("expires undo after five seconds", async () => {
446
vi.useFakeTimers();
447
await useThreadListActions().unpinThread(makeThread());
@@ -466,6 +452,7 @@ describe("thread action undo", () => {
452
expect(state.requests.map(({ action }) => action)).toEqual(["unpin"]);
453
});
454
455
+ // regression: #21401 restore archive and thread action undo
456
it("refreshes the archive after archiving on a settlement-capable server", async () => {
457
await useThreadListActions().archiveThread(makeThread());
458
expect(state.requests.map(({ action }) => action)).toEqual(["archive"]);
apps/mobile/src/features/home/workspace-connection-status.test.ts
-3
@@ -23,9 +23,6 @@ function workspaceState(overrides: Partial<WorkspaceState> = {}): WorkspaceState
23
24
describe("workspace connection status", () => {
25
it.each([
26
- ["connecting", null],
27
- ["reconnecting", null],
28
- ["connecting", "Could not reach sleeping laptop"],
26
["reconnecting", "Could not reach sleeping laptop"],
27
["error", "Could not reach sleeping laptop"],
28
] as const)(
apps/mobile/src/features/projects/AddProjectScreen.test.ts
+6
-90
@@ -10,10 +10,8 @@ import { afterEach, beforeEach, describe, expect, it, vi } from "vite-plus/test"
10
11
const state = vi.hoisted(() => ({
12
scopes: new Set<string>(),
13
- otherScopes: new Set<string>(),
13
baseDirectory: "",
14
projects: [] as string[],
16
- createRequests: [] as { environmentId: string; workspaceRoot: string }[],
15
}));
16
17
vi.mock("react", async (importOriginal) => ({
@@ -54,10 +52,8 @@ vi.mock("../../components/ui/ErrorBanner", () => ({ ErrorBanner: "ErrorBanner" }
52
vi.mock("./SourceControlIcon", () => ({ SourceControlIcon: "SourceControlIcon" }));
53
vi.mock("../../lib/uuid", () => ({ uuidv4: () => "project" }));
54
vi.mock("../../state/session", () => ({
57
- useEnvironmentScope: (environmentId: string, scope: string) =>
58
- (environmentId === "environment" ? state.scopes : state.otherScopes).has(scope),
59
- readEnvironmentScope: (environmentId: string, scope: string) =>
60
- (environmentId === "environment" ? state.scopes : state.otherScopes).has(scope),
55
+ useEnvironmentScope: (_environmentId: string, scope: string) => state.scopes.has(scope),
56
+ readEnvironmentScope: (_environmentId: string, scope: string) => state.scopes.has(scope),
57
}));
58
vi.mock("../../state/entities", () => ({
59
useProjects: () => [],
@@ -70,27 +66,16 @@ vi.mock("../../state/entities", () => ({
66
settings: { addProjectBaseDirectory: state.baseDirectory },
67
},
68
],
73
- [
74
- "other-environment",
75
- {
76
- environment: { platform: { os: "linux" }, capabilities: {} },
77
- settings: { addProjectBaseDirectory: state.baseDirectory },
78
- },
79
- ],
69
]),
70
}));
71
vi.mock("../../state/use-remote-environment-registry", () => ({
72
useRemoteEnvironmentRuntime: () => ({ connectionState: "connected" }),
73
useRemoteConnectionStatus: () => ({
85
- connectedEnvironments: [
86
- { environmentId: "environment", connectionState: "connected" },
87
- { environmentId: "other-environment", connectionState: "connected" },
88
- ],
74
+ connectedEnvironments: [{ environmentId: "environment", connectionState: "connected" }],
75
}),
76
useSavedRemoteConnections: () => ({
77
savedConnectionsById: {
78
connection: { environmentId: "environment", environmentLabel: "Environment" },
93
- other: { environmentId: "other-environment", environmentLabel: "Other environment" },
79
},
80
}),
81
}));
@@ -111,16 +96,8 @@ vi.mock("../../state/sourceControl", () => ({
96
}));
97
vi.mock("../../state/projects", () => ({
98
projectEnvironment: {
114
- create: async ({
115
- environmentId,
116
- input,
117
- }: {
118
- environmentId: string;
119
- input: { workspaceRoot: string };
120
- }) => {
121
- state.createRequests.push({ environmentId, workspaceRoot: input.workspaceRoot });
122
- const scopes = environmentId === "environment" ? state.scopes : state.otherScopes;
123
- if (!scopes.has(AuthOrchestrationOperateScope)) {
99
+ create: async ({ input }: { input: { workspaceRoot: string } }) => {
100
+ if (!state.scopes.has(AuthOrchestrationOperateScope)) {
101
return AsyncResult.failure(Cause.fail(new Error("Project creation denied")));
102
}
103
state.projects.push(input.workspaceRoot);
@@ -129,7 +106,7 @@ vi.mock("../../state/projects", () => ({
106
},
107
}));
108
132
-import { AddProjectDestinationScreen, AddProjectLocalFolderScreen } from "./AddProjectScreen";
109
+import { AddProjectDestinationScreen } from "./AddProjectScreen";
110
111
function findAction(node: ReactNode, label: string): (() => unknown) | null {
112
if (Array.isArray(node)) {
@@ -159,21 +136,13 @@ function cloneAction() {
136
return action;
137
}
138
162
-function localProjectAction(environmentId = "environment") {
163
- const action = findAction(AddProjectLocalFolderScreen({ environmentId }), "Add project");
164
- if (!action) throw new Error("Add project action missing");
165
- return action;
166
-}
167
-
139
describe("clone project permissions", () => {
140
beforeEach(async () => {
141
state.baseDirectory = await NodeFSP.mkdtemp(
142
NodePath.join(NodeOS.tmpdir(), "t3-clone-permissions-"),
143
);
144
state.scopes = new Set([AuthSourceControlWriteScope]);
174
- state.otherScopes = new Set();
145
state.projects = [];
176
- state.createRequests = [];
146
});
147
148
afterEach(async () => {
@@ -200,56 +169,3 @@ describe("clone project permissions", () => {
169
},
170
);
171
});
203
-
204
-describe("local project permissions", () => {
205
- beforeEach(() => {
206
- state.baseDirectory = "/workspace/project";
207
- state.scopes = new Set();
208
- state.otherScopes = new Set();
209
- state.projects = [];
210
- state.createRequests = [];
211
- });
212
-
213
- it.each([false, true])(
214
- "does not dispatch project creation without the current grant (revoked: %s)",
215
- async (revokeBeforeSubmit) => {
216
- if (revokeBeforeSubmit) state.scopes.add(AuthOrchestrationOperateScope);
217
- const submit = localProjectAction();
218
- state.scopes.delete(AuthOrchestrationOperateScope);
219
-
220
- await submit();
221
-
222
- expect(state.createRequests).toEqual([]);
223
- expect(state.projects).toEqual([]);
224
- },
225
- );
226
-
227
- it("adds a typed local path with only task-operation permission", async () => {
228
- state.scopes.add(AuthOrchestrationOperateScope);
229
-
230
- await localProjectAction()();
231
-
232
- expect(state.createRequests).toEqual([
233
- { environmentId: "environment", workspaceRoot: state.baseDirectory },
234
- ]);
235
- expect(state.projects).toEqual([state.baseDirectory]);
236
- });
237
-
238
- it.each([false, true])(
239
- "uses the selected environment's grant (allowed: %s)",
240
- async (allowSelectedEnvironment) => {
241
- (allowSelectedEnvironment ? state.otherScopes : state.scopes).add(
242
- AuthOrchestrationOperateScope,
243
- );
244
-
245
- await localProjectAction("other-environment")();
246
-
247
- expect(state.createRequests).toEqual(
248
- allowSelectedEnvironment
249
- ? [{ environmentId: "other-environment", workspaceRoot: state.baseDirectory }]
250
- : [],
251
- );
252
- expect(state.projects).toEqual(allowSelectedEnvironment ? [state.baseDirectory] : []);
253
- },
254
- );
255
-});
apps/mobile/src/features/prompt-links/prompt-link-model.test.ts
+1
-9
@@ -1,7 +1,7 @@
1
import { parseNewThreadLink } from "@t3tools/shared/promptLinks";
2
import { describe, expect, it } from "vite-plus/test";
3
4
-import { linkedThreadDraftAction, promptLinkSearchFromParams } from "./prompt-link-model";
4
+import { promptLinkSearchFromParams } from "./prompt-link-model";
5
6
describe("promptLinkSearchFromParams", () => {
7
it("round-trips decoded route params into the shared parser", () => {
@@ -24,11 +24,3 @@ describe("promptLinkSearchFromParams", () => {
24
});
25
});
26
});
27
-
28
-describe("linkedThreadDraftAction", () => {
29
- it("fills an empty composer and asks before replacing typed text", () => {
30
- expect(linkedThreadDraftAction(" \n", "Do it")).toBe("fill");
31
- expect(linkedThreadDraftAction("Do it", "Do it")).toBe("keep");
32
- expect(linkedThreadDraftAction("My notes", "Do it")).toBe("ask");
33
- });
34
-});
apps/mobile/src/features/pull-requests/guide/reviewGuideState.test.ts
deleted
-25
@@ -1,25 +0,0 @@
1
-import { describe, expect, it } from "vite-plus/test";
2
-import {
3
- IsoDateTime,
4
- ProviderInstanceId,
5
- type PullRequestReviewGuideResult,
6
-} from "@t3tools/contracts";
7
-import { reviewGuideState } from "./reviewGuideState";
8
-
9
-const guide: NonNullable<PullRequestReviewGuideResult["guide"]> = {
10
- headSha: "old-head",
11
- generatedAt: IsoDateTime.make("2026-10-11T00:00:00.000Z"),
12
- modelSelection: { instanceId: ProviderInstanceId.make("codex"), model: "gpt-5" },
13
- stops: [],
14
-};
15
-
16
-describe("mobile review guide state", () => {
17
- it("keeps a previous guide readable during a rewrite", () => {
18
- const state = reviewGuideState({
19
- guide,
20
- currentHeadSha: "new-head",
21
- run: { _tag: "Running", headSha: "new-head", startedAt: guide.generatedAt },
22
- });
23
- expect(state).toMatchObject({ guide, stale: true, running: true, failure: null });
24
- });
25
-});
apps/mobile/src/features/pull-requests/pullRequestList.test.ts
-19
@@ -66,25 +66,6 @@ describe("recycled PR list rows", () => {
66
environmentId: EnvironmentId.make("env-one"),
67
});
68
69
- it.each([
70
- { title: "New title" },
71
- { additions: 8 },
72
- { deletions: 4 },
73
- { checksState: "failing" as const },
74
- { reviewDecision: "approved" as const },
75
- { viewerReviewRequested: true },
76
- { isDraft: true },
77
- { state: "closed" as const },
78
- { mergeability: "conflicting" as const },
79
- { baseBranch: "release" },
80
- { author: { login: "another", name: null, avatarUrl: null } },
81
- { author: { login: "octocat", name: null, avatarUrl: "https://example.com/avatar.png" } },
82
- { labels: [{ name: "bug", color: "ff0000" }] },
83
- { stack: { number: 1, position: 2, size: 3, base: "main" } },
84
- ])("updates the row when visible status or quick actions change: %j", (patch) => {
85
- expect(pullRequestListRowsAreEqual(scopedEntry(), scopedEntry(patch))).toBe(false);
86
- });
87
-
69
it("updates navigation and commands when a duplicate moves to another environment", () => {
70
const original = scopedEntry();
71
expect(
apps/mobile/src/features/pull-requests/pullRequestReviewDrafts.test.ts
+1
-24
@@ -1,9 +1,5 @@
1
import { describe, expect, it } from "vite-plus/test";
2
-import {
3
- clearSubmittedReview,
4
- pullRequestReviewKey,
5
- type ReviewDraft,
6
-} from "./pullRequestReviewDrafts";
2
+import { clearSubmittedReview, type ReviewDraft } from "./pullRequestReviewDrafts";
3
const comment = {
4
id: "one",
5
path: "renamed.ts",
@@ -35,23 +31,4 @@ describe("mobile review draft recovery", () => {
31
comments: [],
32
});
33
});
38
- it("does not mix identical PR numbers across repositories, hosts, or environments", () => {
39
- const ref = {
40
- environmentId: "a",
41
- projectId: "p",
42
- host: "github.com",
43
- repository: "one/repo",
44
- number: 1,
45
- };
46
- expect(
47
- new Set(
48
- [
49
- ref,
50
- { ...ref, environmentId: "b" },
51
- { ...ref, host: "github.enterprise" },
52
- { ...ref, repository: "two/repo" },
53
- ].map(pullRequestReviewKey),
54
- ).size,
55
- ).toBe(4);
56
- });
34
});
apps/mobile/src/features/pull-requests/usePullRequestAgentActions.test.ts
deleted
-44
@@ -1,44 +0,0 @@
1
-import { beforeEach, describe, expect, it, vi } from "vite-plus/test";
2
-import type { PullRequestDetail } from "@t3tools/contracts";
3
-import { usePullRequestAgentActions } from "./usePullRequestAgentActions";
4
-
5
-const state = vi.hoisted(() => ({
6
- connected: false,
7
- canAsk: true,
8
- ask: vi.fn(),
9
-}));
10
-vi.mock("./usePullRequestConnected", () => ({
11
- usePullRequestConnected: () => state.connected,
12
-}));
13
-vi.mock("./usePullRequestThreads", () => ({
14
- usePullRequestThreads: () => ({
15
- threads: [],
16
- canAsk: state.canAsk,
17
- canWatch: true,
18
- busy: false,
19
- isPending: true,
20
- ask: state.ask,
21
- }),
22
-}));
23
-const params = {
24
- environmentId: "environment",
25
- projectId: "project",
26
- repository: "owner/repo",
27
- number: 1,
28
-};
29
-const pr = { state: "open", mergeability: "conflicting" } as PullRequestDetail;
30
-
31
-beforeEach(() => {
32
- state.connected = false;
33
- state.canAsk = true;
34
- state.ask.mockClear();
35
-});
36
-
37
-describe("PR agent drafts", () => {
38
- it("does not open drafts when the connection denies task access", () => {
39
- state.connected = true;
40
- state.canAsk = false;
41
- usePullRequestAgentActions(params, pr).start("explain");
42
- expect(state.ask).not.toHaveBeenCalled();
43
- });
44
-});
apps/mobile/src/features/review/reviewModel.test.ts
-1
@@ -5,7 +5,6 @@ import { applyReviewDiffMetadata, buildReviewParsedDiff } from "./reviewModel";
5
describe("buildReviewParsedDiff", () => {
6
it.each([
7
["a/example.ts", "a/example.ts"],
8
- ["b/example.ts", "b/example.ts"],
8
["a/before.ts", "b/after.ts"],
9
])("preserves repository paths from %s to %s", (previousPath, path) => {
10
const parsed = buildReviewParsedDiff(
apps/mobile/src/features/settings/components/BranchNamingSettings.test.tsx
+1
@@ -89,6 +89,7 @@ describe("BranchNamingSettings", () => {
89
});
90
});
91
92
+ // regression: #18381 branch naming text saves when you leave the screen
93
it("saves both drafts in one patch when the screen closes", () => {
94
render("static");
95
act(() => input(PREFIX).onChangeText("feat/"));
apps/mobile/src/features/settings/lib/legal-document-url.test.ts
+6
-8
@@ -3,12 +3,10 @@ import { describe, expect, it } from "vite-plus/test";
3
import { isLegalDocumentUrl } from "./legal-document-url";
4
5
describe("isLegalDocumentUrl", () => {
6
- it.each([
7
- "https://t3.codes/download",
8
- "https://example.com/legal",
9
- "javascript:alert(1)",
10
- "not-a-url",
11
- ])("rejects a URL outside the legal-document allowlist: %s", (url) => {
12
- expect(isLegalDocumentUrl(url)).toBe(false);
13
- });
6
+ it.each(["https://example.com/legal", "javascript:alert(1)"])(
7
+ "rejects a URL outside the legal-document allowlist: %s",
8
+ (url) => {
9
+ expect(isLegalDocumentUrl(url)).toBe(false);
10
+ },
11
+ );
12
});
apps/mobile/src/features/settings/scheduledTaskDraft.test.ts
-37
@@ -5,12 +5,9 @@ import {
5
ProviderDriverKind,
6
ProviderInstanceId,
7
ProjectId,
8
- ScheduledTaskId,
9
- type ScheduledTask,
8
} from "@t3tools/contracts";
9
import {
10
scheduledTaskDefaultModel,
13
- editDraft,
11
DEFAULT_SCHEDULE,
12
scheduleDraftForTask,
13
scheduleFromDraft,
@@ -92,10 +89,7 @@ describe("scheduleFromDraft", () => {
89
90
it.each([
91
["1.5", 90_000],
95
- ["1000001", 60_000_060_000],
92
[String(60_001 / 60_000), 60_001],
97
- [String(65_000 / 60_000), 65_000],
98
- [String(123_456 / 60_000), 123_456],
93
])("preserves a valid %s minute interval when saving", (intervalMinutes, everyMs) => {
94
expect(scheduleFromDraft({ ...DEFAULT_SCHEDULE, mode: "interval", intervalMinutes })).toEqual({
95
type: "interval",
@@ -104,37 +98,6 @@ describe("scheduleFromDraft", () => {
98
});
99
});
100
107
-const legacyTask: ScheduledTask = {
108
- id: ScheduledTaskId.make("legacy-task"),
109
- title: "Review issues",
110
- prompt: "Review open issues",
111
- enabled: true,
112
- schedule: { type: "interval", everyMs: 60_000 },
113
- projectId: ProjectId.make("project"),
114
- threadId: null,
115
- workspaceStrategy: { type: "worktree", baseRef: "release" },
116
- modelSelection: { instanceId: ProviderInstanceId.make("codex"), model: "gpt-5.4" },
117
- runtimeMode: "full-access",
118
- interactionMode: "default",
119
- createdBy: "user",
120
- creationSource: "web",
121
- createdAt: "2026-09-17T00:00:00.000Z",
122
- updatedAt: "2026-09-17T00:00:00.000Z",
123
- nextRunAt: null,
124
- lastRunAt: null,
125
- lastRunStatus: "never",
126
- lastRunError: null,
127
- runCount: 0,
128
-};
129
-
130
-describe("editing scheduled task branch settings", () => {
131
- it("keeps an omitted origin flag on the local base branch", () => {
132
- const draft = editDraft(legacyTask);
133
- expect(draft.baseRef).toBe("release");
134
- expect(draft.startFromOrigin).toBe(false);
135
- });
136
-});
137
-
101
describe("scheduled task model defaults", () => {
102
const instanceId = ProviderInstanceId.make("codex");
103
const projectId = ProjectId.make("project");
apps/mobile/src/features/sharing/incoming-share-model.test.ts
-65
@@ -253,32 +253,6 @@ describe("incoming native shares", () => {
253
]);
254
});
255
256
- it("records the stored copy's measured size when a content URI under-reports", async () => {
257
- const file: SharePayload = {
258
- shareType: "file",
259
- value: "content://shared/report",
260
- mimeType: "application/pdf",
261
- };
262
- const persistFile = vi.fn(async () => "file:///documents/report.pdf");
263
- const readSize = vi.fn(async (uri: string) => (uri.startsWith("content:") ? 42 : 4200));
264
-
265
- const result = await buildIncomingShareDraft({
266
- id: "share-android-report",
267
- createdAt: "2026-07-15T10:00:00.000Z",
268
- payloads: [file],
269
- resolvedPayloads: [],
270
- fileReader: {
271
- readBase64: async () => "unused",
272
- persistFile,
273
- readSize,
274
- removeOwnedFile: async () => undefined,
275
- },
276
- });
277
-
278
- expect(result.attachments).toHaveLength(1);
279
- expect(result.attachments[0]?.sizeBytes).toBe(4200);
280
- });
281
-
256
it("rejects a shared file whose persisted copy measures empty and releases the copy", async () => {
257
const file: SharePayload = {
258
shareType: "file",
@@ -360,36 +334,6 @@ describe("incoming native shares", () => {
334
expect(removeOwnedFile.mock.calls.map(([uri]) => uri)).toEqual([resolvedUri, payloadUri]);
335
});
336
363
- it("keeps images and rejects shared files on servers without file support", () => {
364
- const image = {
365
- id: "image-1",
366
- type: "image" as const,
367
- name: "image.png",
368
- mimeType: "image/png",
369
- sizeBytes: 3,
370
- dataUrl: "data:image/png;base64,YWJj",
371
- previewUri: "data:image/png;base64,YWJj",
372
- };
373
- const file = {
374
- id: "file-1",
375
- type: "file" as const,
376
- name: "report.pdf",
377
- mimeType: "application/pdf",
378
- sizeBytes: 42,
379
- fileUri: "file:///documents/report.pdf",
380
- };
381
-
382
- expect(
383
- selectIncomingShareAttachments({
384
- attachments: [image, file],
385
- maxFileAttachmentBytes: null,
386
- }),
387
- ).toEqual({
388
- attachments: [image],
389
- warnings: ["'report.pdf' was skipped because this server does not support files."],
390
- });
391
- });
392
-
337
it("uses current server support and limits when selecting a reserved share", () => {
338
const file = {
339
id: "file-1",
@@ -574,15 +518,6 @@ describe("share cleanup ownership", () => {
518
"file:///var/mobile/Containers/Shared/AppGroup/GROUP",
519
];
520
577
- it("allows deleting files inside the app's own directories", () => {
578
- expect(
579
- isShareFileUriUnderOwnedRoots(
580
- "file:///var/mobile/Containers/Shared/AppGroup/GROUP/shared.pdf",
581
- ownedRoots,
582
- ),
583
- ).toBe(true);
584
- });
585
-
521
it("treats /private/var and /var as the same iOS location", () => {
522
expect(
523
isShareFileUriUnderOwnedRoots(
apps/mobile/src/features/sharing/incoming-share-native.test.ts
+1
@@ -17,6 +17,7 @@ describe("createIncomingSharePayloadReader", () => {
17
expect(readPayloads).toHaveBeenCalledTimes(1);
18
});
19
20
+ // regression: #4943 stop shared content errors in Personal Team builds
21
it("preserves other native errors", () => {
22
const error = new Error("native failure");
23
const read = createIncomingSharePayloadReader({
apps/mobile/src/features/terminal/terminalLaunchContext.test.ts
-30
@@ -81,34 +81,4 @@ describe("pending terminal launches", () => {
81
});
82
expect(takePendingTerminalLaunch(target)).toBeNull();
83
});
84
-
85
- it("keeps pending launches isolated per terminal target", () => {
86
- const primaryTarget = {
87
- environmentId: EnvironmentId.make("env-1"),
88
- threadId: ThreadId.make("thread-1"),
89
- terminalId: "term-2",
90
- };
91
- const otherTarget = {
92
- environmentId: EnvironmentId.make("env-1"),
93
- threadId: ThreadId.make("thread-1"),
94
- terminalId: "term-3",
95
- };
96
-
97
- stagePendingTerminalLaunch({
98
- target: primaryTarget,
99
- launch: {
100
- cwd: "/repo/root",
101
- worktreePath: null,
102
- initialInput: "pnpm i\r",
103
- },
104
- });
105
-
106
- expect(takePendingTerminalLaunch(otherTarget)).toBeNull();
107
- expect(takePendingTerminalLaunch(primaryTarget)).toEqual({
108
- cwd: "/repo/root",
109
- worktreePath: null,
110
- env: undefined,
111
- initialInput: "pnpm i\r",
112
- });
113
- });
84
});
apps/mobile/src/features/terminal/useTerminalSurfaceBuffer.test.ts
+10
-11
@@ -58,14 +58,13 @@ afterEach(async () => {
58
vi.unstubAllGlobals();
59
});
60
61
-it.each([
62
- "secondary:thread:term-1",
63
- "environment:another-thread:term-1",
64
- "environment:thread:term-2",
65
-])("does not carry history into another terminal target (%s)", async (terminalKey) => {
66
- await render();
67
- await render({ terminalKey, buffer: null });
68
- expect(displayed).toHaveBeenLastCalledWith({ buffer: "", readOnly: false });
69
- await render({ terminalKey, buffer: "new target" });
70
- expect(displayed).toHaveBeenLastCalledWith({ buffer: "new target", readOnly: false });
71
-});
61
+it.each(["secondary:thread:term-1", "environment:thread:term-2"])(
62
+ "does not carry history into another terminal target (%s)",
63
+ async (terminalKey) => {
64
+ await render();
65
+ await render({ terminalKey, buffer: null });
66
+ expect(displayed).toHaveBeenLastCalledWith({ buffer: "", readOnly: false });
67
+ await render({ terminalKey, buffer: "new target" });
68
+ expect(displayed).toHaveBeenLastCalledWith({ buffer: "new target", readOnly: false });
69
+ },
70
+);
apps/mobile/src/features/threads/checkout-new-task-branch.test.ts
-2
@@ -326,8 +326,6 @@ describe("new-task branch checkout", () => {
326
327
it.each([
328
{ source: "historical", nested: true },
329
- { source: "picker", nested: true },
330
- { source: "historical", nested: false },
329
{ source: "picker", nested: false },
330
])(
331
"rejects $source worktree reuse when project root is unsafe (nested: $nested)",
apps/mobile/src/features/threads/composerSendPresentation.test.ts
-25
@@ -11,31 +11,6 @@ const idle = {
11
} as const;
12
13
describe("resolveComposerSendPresentation", () => {
14
- it("follows the configured behavior once a turn is running", () => {
15
- const queueing = resolveComposerSendPresentation({
16
- ...idle,
17
- running: true,
18
- canSteer: true,
19
- followUpBehavior: "queue",
20
- });
21
- const steering = resolveComposerSendPresentation({
22
- ...idle,
23
- running: true,
24
- canSteer: true,
25
- followUpBehavior: "steer",
26
- });
27
-
28
- expect(queueing.label).toBe("Queue");
29
- expect(queueing.icon).toBe("list.number");
30
- expect(queueing.action).toBe("queue");
31
- expect(queueing.alternate).toBe("steer");
32
- expect(steering.label).toBe("Steer");
33
- expect(steering.icon).toBe("arrow.turn.left.up");
34
- expect(steering.action).toBe("steer");
35
- expect(steering.alternate).toBe("queue");
36
- expect(steering.offersFollowUpChoice).toBe(true);
37
- });
38
-
14
it("never promises steering the provider cannot do", () => {
15
const presentation = resolveComposerSendPresentation({
16
...idle,
apps/mobile/src/features/threads/new-task-context-presentation.test.ts
+1
@@ -34,6 +34,7 @@ describe("resolveNewTaskWorkspaceSelection", () => {
34
},
35
);
36
37
+ // regression: #21404 use current checkout for non-git projects
38
it("preserves the selection and defaults for git projects", () => {
39
const selection = { mode: "local", branch: "feature", worktreePath: "/worktree" } as const;
40
expect(resolveNewTaskWorkspaceSelection({ selection, fallback, isGitRepo: true })).toBe(
apps/mobile/src/features/threads/thread-feed-live-follow.test.ts
+2
-4
@@ -63,11 +63,7 @@ describe("tool-group append following", () => {
63
64
it.each([
65
{ name: "reading earlier calls", changes: { scrollOffset: 20 } },
66
- { name: "dragging before leaving the edge", changes: { userScrolling: true } },
67
- { name: "opening detail during an append", changes: { detailsChanged: true } },
66
{ name: "streaming a result", changes: { rows: previousRows, contentHeight: 600 } },
69
- { name: "updating a lifecycle label", changes: { rows: previousRows, contentHeight: 289 } },
70
- { name: "prepending old calls", changes: { rows: [{ id: "older" }, ...previousRows] } },
67
{
68
name: "replacing a call while appending",
69
changes: { rows: [{ id: "replacement" }, ...appendedRows.slice(1)] },
@@ -114,6 +110,7 @@ describe("resolveThreadFeedSubmissionAnchor", () => {
110
).toBeNull();
111
});
112
113
+ // regression: #7897 stop pushing follow-up messages to the top
114
it("does not anchor a thread that has already started a turn", () => {
115
expect(
116
resolveThreadFeedSubmissionAnchor({
@@ -128,6 +125,7 @@ describe("resolveThreadFeedSubmissionAnchor", () => {
125
});
126
127
describe("resolveThreadFeedLiveFollow", () => {
128
+ // regression: #5986 stabilize thread composer and interactions
129
it("pauses immediately when the user starts scrolling", () => {
130
expect(resolveThreadFeedLiveFollow(true, { type: "user-scroll-begin" })).toBe(false);
131
});
apps/mobile/src/features/threads/thread-settings-options.test.ts
+1
@@ -23,6 +23,7 @@ const effortDescriptor: Extract<ProviderOptionDescriptor, { type: "select" }> =
23
};
24
25
describe("selectableChoices", () => {
26
+ // regression: #21406 bring model controls in line with web
27
it("includes prompt-injected and workflow choices in declared order", () => {
28
expect(selectableChoices(effortDescriptor).map((choice) => choice.id)).toEqual([
29
"low",
apps/mobile/src/features/threads/thread-settings-sheet-state.test.ts
+1
@@ -133,6 +133,7 @@ describe("thread settings sheet state", () => {
133
]);
134
});
135
136
+ // regression: #16816 sync model favorites and visibility across clients
137
it("cannot select a hidden model exposed only for visibility management", () => {
138
const pending = modelOption("gpt-next");
139
expect(
apps/mobile/src/features/threads/threadContentPresentation.test.ts
-15
@@ -28,19 +28,4 @@ describe("thread content presentation", () => {
28
detail: "Reconnect this environment to load the conversation.",
29
});
30
});
31
-
32
- it("surfaces detail errors before presenting a loading state", () => {
33
- expect(
34
- projectThreadContentPresentation({
35
- hasDetail: false,
36
- detailError: "The thread stream failed.",
37
- detailDeleted: false,
38
- connectionState: "connected",
39
- }),
40
- ).toEqual({
41
- kind: "unavailable",
42
- title: "Could not load conversation",
43
- detail: "The thread stream failed.",
44
- });
45
- });
31
});
apps/mobile/src/features/threads/threadDragGap.test.ts
deleted
-16
@@ -1,16 +0,0 @@
1
-import { describe, expect, it } from "vite-plus/test";
2
-import { threadDragAction, threadOrderAfterMove } from "./threadOrder";
3
-
4
-describe("drag action labels", () => {
5
- it("does not offer a parked-section reorder or snooze without a wake time", () => {
6
- expect(threadDragAction("settled", "settled")).toBeNull();
7
- expect(threadDragAction("active", "snoozed")).toBeNull();
8
- expect(
9
- threadOrderAfterMove(["a", "b"], "a", {
10
- section: "settled",
11
- targetId: null,
12
- placement: "before",
13
- }),
14
- ).toBeNull();
15
- });
16
-});
apps/mobile/src/features/threads/threadListV2.test.ts
-153
@@ -12,7 +12,6 @@ import {
12
type ThreadMoveAvailability,
13
} from "./threadOrder";
14
import type { EnvironmentThreadShell } from "@t3tools/client-runtime/state/shell";
15
-import { threadSearchMatchKey } from "@t3tools/client-runtime/state/thread-search";
15
import { resolveSnoozePresets } from "@t3tools/client-runtime/state/thread-settled";
16
import {
17
CommandId,
@@ -36,7 +35,6 @@ import {
35
resolveThreadListV2SnoozeMenuSelection,
36
resolveThreadListV2Status,
37
resolveThreadListV2WokeAt,
39
- resolveThreadListV2SwipeActions,
38
sortThreadsForListV2,
39
threadListV2ListItemsAreEqual,
40
threadHasUnseenCompletion,
@@ -151,32 +149,6 @@ describe("queued messages keep a settled thread active", () => {
149
]);
150
expect(layout.settledCount).toBe(1);
151
});
154
-
155
- it("includes it in the reorderable active section", () => {
156
- expect(
157
- getThreadListV2OrderedSection({ threads, section: "active", now: NOW, queuedThreadKeys }).map(
158
- (thread) => thread.id,
159
- ),
160
- ).toEqual(["active", "settled-queued"]);
161
- expect(
162
- getThreadListV2OrderedSection({ threads, section: "active", now: NOW }).map(
163
- (thread) => thread.id,
164
- ),
165
- ).toEqual(["active"]);
166
- });
167
-});
168
-
169
-describe("resolveThreadListV2SwipeActions", () => {
170
- it("falls back to archive only for a pre-lifecycle server", () => {
171
- expect(
172
- resolveThreadListV2SwipeActions({
173
- variant: "card",
174
- settlementSupported: false,
175
- snoozeSupported: false,
176
- snoozable: true,
177
- }),
178
- ).toEqual({ primary: "archive", secondary: null });
179
- });
152
});
153
154
describe("sortThreadsForListV2", () => {
@@ -433,34 +405,6 @@ describe("buildThreadListV2Items", () => {
405
expect(layout.settledShelfHeaderIndex).toBe(1);
406
});
407
436
- it("keeps the selected settled thread visible when its shelf is collapsed", () => {
437
- const layout = buildThreadListV2Items({
438
- threads: [
439
- makeThread({
440
- id: ThreadId.make("selected"),
441
- title: "Selected",
442
- settledOverride: "settled",
443
- settledAt: NOW,
444
- }),
445
- makeThread({
446
- id: ThreadId.make("other"),
447
- title: "Other",
448
- settledOverride: "settled",
449
- settledAt: NOW,
450
- }),
451
- ],
452
- environmentId: null,
453
- searchQuery: "",
454
- now: NOW,
455
- settledShelfExpanded: false,
456
- selectedThreadKey: `${environmentId}:selected`,
457
- });
458
-
459
- expect(layout.items.map((item) => item.thread.id)).toEqual(["selected"]);
460
- expect(layout.settledCount).toBe(2);
461
- expect(layout.settledShelfHeaderIndex).toBe(0);
462
- });
463
-
408
it("keeps settled threads in the tail and filters by search query", () => {
409
const { items } = buildThreadListV2Items({
410
threads: [
@@ -484,48 +428,6 @@ describe("buildThreadListV2Items", () => {
428
]);
429
});
430
487
- it("includes a thread matched by message content", () => {
488
- const thread = makeThread({
489
- id: ThreadId.make("content-match"),
490
- title: "Unrelated title",
491
- });
492
- const { items } = buildThreadListV2Items({
493
- threads: [thread],
494
- environmentId: null,
495
- searchQuery: "relay reconnect",
496
- matchedThreadKeys: new Set([
497
- threadSearchMatchKey({
498
- environmentId,
499
- threadId: thread.id,
500
- }),
501
- ]),
502
- now: NOW,
503
- });
504
-
505
- expect(items.map((item) => item.thread.id)).toEqual(["content-match"]);
506
- });
507
-
508
- it("scopes the flat list to one project", () => {
509
- const projectId = ProjectId.make("project-1");
510
- const otherProjectId = ProjectId.make("project-2");
511
- const { items } = buildThreadListV2Items({
512
- threads: [
513
- makeThread({ id: ThreadId.make("included"), projectId, title: "Included" }),
514
- makeThread({
515
- id: ThreadId.make("excluded"),
516
- projectId: otherProjectId,
517
- title: "Excluded",
518
- }),
519
- ],
520
- environmentId: null,
521
- projectRefs: [{ environmentId, projectId }],
522
- searchQuery: "",
523
- now: NOW,
524
- });
525
-
526
- expect(items.map((item) => item.thread.id)).toEqual(["included"]);
527
- });
528
-
431
it("scopes the flat list to every environment member of a logical project", () => {
432
const remoteEnvironmentId = EnvironmentId.make("environment-remote");
433
const projectId = ProjectId.make("project-1");
@@ -898,12 +800,6 @@ describe("pending mobile thread moves", () => {
800
}
801
});
802
901
- it("keeps search results in the full pending section order", () => {
902
- const { rows, assignments, pending, update } = fixture();
903
- const current = update(update(rows, assignments[0]!), assignments[1]!);
904
- expect(layout(current, pending, "match")).toEqual(["c", "b"]);
905
- });
906
-
803
it("releases for real section membership and foreign key changes", () => {
804
const { rows, pending } = fixture();
805
expect(reconcilePendingThreadOrder(pending, rows.slice(1))).toBeNull();
@@ -1022,20 +918,6 @@ describe("mobile move availability", () => {
918
expect(assignments![0]!.orderKey > "dd" && assignments![0]!.orderKey < "ff").toBe(true);
919
},
920
);
1025
-
1026
- it("allows an independent keyed move despite an unsupported keyless row elsewhere", () => {
1027
- const ordered = rows("active", [null, null, "bb", "dd", "ff"]);
1028
- const plan = createThreadMovePlanner({
1029
- ordered,
1030
- section: "active",
1031
- reorderableEnvironmentIds: new Set([environmentId]),
1032
- });
1033
- const assignments = plan(`${environmentId}:move-4`, "up");
1034
- expect(assignments).toHaveLength(1);
1035
- expect(assignments![0]!.id).toBe(`${environmentId}:move-4`);
1036
- expect(assignments![0]!.orderKey > "bb").toBe(true);
1037
- expect(assignments![0]!.orderKey < "dd").toBe(true);
1038
- });
921
});
922
923
describe("thread drag destinations", () => {
@@ -1214,15 +1096,6 @@ describe("cross-section thread drops", () => {
1096
unsnooze: false,
1097
});
1098
});
1217
- it("does not send lifecycle commands for an ordinary Active reorder", () => {
1218
- expect(
1219
- threadDropLifecycle(
1220
- makeThread({ id: ThreadId.make("active"), title: "active" }),
1221
- "active",
1222
- NOW,
1223
- ),
1224
- ).toEqual({ pin: false, unpin: false, unsettle: false, unsnooze: false });
1225
- });
1099
});
1100
1101
it("excludes subagents from navigation, search and ordering while retaining user forks", () => {
@@ -1332,24 +1205,6 @@ describe("threadListV2ListItemsAreEqual", () => {
1205
}
1206
});
1207
1335
- it("notices a replaced thread shell", () => {
1336
- const replacement = makeThread({ id: ThreadId.make("eq"), title: "renamed" });
1337
- const rebuilt = buildThreadListV2Items({
1338
- threads: [replacement],
1339
- environmentId: null,
1340
- searchQuery: "",
1341
- now: NOW,
1342
- });
1343
- const next = buildThreadListV2ListItems({
1344
- items: rebuilt.items,
1345
- pendingTasks: [],
1346
- snoozeLabelNow: NOW,
1347
- });
1348
- const previousThread = build().find((item) => item.type === "v2-thread")!;
1349
- const nextThread = next.find((item) => item.type === "v2-thread")!;
1350
- expect(threadListV2ListItemsAreEqual(previousThread, nextThread)).toBe(false);
1351
- });
1352
-
1208
it("notices a changed wake countdown label", () => {
1209
const snoozedLayout = buildThreadListV2Items({
1210
threads: [
@@ -1652,14 +1507,6 @@ describe("Working section beta", () => {
1507
expect(off.workingCount).toBe(0);
1508
});
1509
1655
- it("shows working rows as cards when expanded, or only the selected one when collapsed", () => {
1656
- expect(build({ workingShelfExpanded: true }).items.at(-1)).toMatchObject({
1657
- thread: { id: "working" },
1658
- variant: "card",
1659
- });
1660
- expect(ids(build({ selectedThreadKey: `${environmentId}:working` })).at(-1)).toBe("working");
1661
- });
1662
-
1510
it("orders the inbox by the latest return this device observed", () => {
1511
const layout = build({
1512
inboxReturnAt: (thread) =>
apps/mobile/src/features/threads/threadQueueControlPresentation.test.ts
-26
@@ -33,32 +33,6 @@ describe("threadQueueControlPresentation", () => {
33
);
34
});
35
36
- it("disables edge reorder controls and busy dismissal", () => {
37
- const first = resolveThreadQueueRowControls({
38
- busy: false,
39
- canPromoteToSteer: false,
40
- canReorder: true,
41
- index: 0,
42
- queuedCount: 2,
43
- text: "First",
44
- });
45
- const busy = resolveThreadQueueRowControls({
46
- busy: true,
47
- canPromoteToSteer: true,
48
- canReorder: true,
49
- index: 0,
50
- queuedCount: 1,
51
- text: "Queued message",
52
- });
53
-
54
- expect(first.canMoveUp).toBe(false);
55
- expect(first.canMoveDown).toBe(true);
56
- expect(first.canSteer).toBe(false);
57
- expect(busy.canDismiss).toBe(false);
58
- expect(busy.canMoveUp).toBe(false);
59
- expect(busy.canSteer).toBe(false);
60
- });
61
-
36
it("keeps the row already open in the composer from being reopened or steered", () => {
37
const editing = resolveThreadQueueRowControls({
38
busy: false,
apps/mobile/src/features/threads/use-composer-command-menu.test.ts
-12
@@ -59,18 +59,6 @@ describe("mobile slash commands", () => {
59
},
60
);
61
62
- it("does not offer a native command inside the message", () => {
63
- expect(
64
- buildComposerSlashCommandItems({
65
- query: "plan",
66
- atMessageStart: false,
67
- hasThread: false,
68
- allowInteractionMode: true,
69
- selectedProviderStatus: antigravity,
70
- }),
71
- ).toEqual([]);
72
- });
73
-
62
it("still applies the T3 plan command for supported providers", () => {
63
const items = buildComposerSlashCommandItems({
64
query: "plan",
apps/mobile/src/features/updates/app-updates.test.ts
-54
@@ -194,28 +194,6 @@ describe("runAppUpdateCheck", () => {
194
expect(client.reloadAsync).toHaveBeenCalledOnce();
195
});
196
197
- it("reports manual failures without continuing the update", async () => {
198
- const reportError = vi.spyOn(console, "error").mockImplementation(() => {});
199
- const client = makeUpdateClient({
200
- checkForUpdateAsync: vi.fn(async () => {
201
- throw new Error("offline");
202
- }),
203
- });
204
- const failures: string[] = [];
205
- const states: AppUpdateCheckState[] = [];
206
-
207
- await runAppUpdateCheck({
208
- client,
209
- onFailure: (message) => failures.push(message),
210
- onStateChange: (state) => states.push(state),
211
- });
212
-
213
- expect(client.fetchUpdateAsync).not.toHaveBeenCalled();
214
- expect(failures).toEqual(["offline"]);
215
- expect(states).toEqual(["checking", "idle"]);
216
- reportError.mockRestore();
217
- });
218
-
197
it.each(["ERR_NOT_AVAILABLE_IN_DEV_CLIENT", "ERR_UPDATES_DISABLED"])(
198
"treats Expo's %s failure as an unavailable update check",
199
async (code) => {
@@ -280,38 +258,6 @@ describe("runAppUpdateCheck", () => {
258
expect(client.checkForUpdateAsync).toHaveBeenCalledTimes(2);
259
});
260
283
- it("forwards failures to a manual check coalesced with the launch check", async () => {
284
- const reportError = vi.spyOn(console, "error").mockImplementation(() => {});
285
- let rejectCheck!: (error: Error) => void;
286
- const checkResult = new Promise<{
287
- readonly isAvailable: boolean;
288
- readonly isRollBackToEmbedded: boolean;
289
- }>((_resolve, reject) => {
290
- rejectCheck = reject;
291
- });
292
- const client = makeUpdateClient({
293
- checkForUpdateAsync: vi.fn(() => checkResult),
294
- });
295
- const checkOnLaunch = createAppUpdateLaunchCheck(client);
296
- const failures: string[] = [];
297
- const manualStates: AppUpdateCheckState[] = [];
298
-
299
- const launchCheck = checkOnLaunch();
300
- const manualCheck = runAppUpdateCheck({
301
- client,
302
- onFailure: (message) => failures.push(message),
303
- onStateChange: (state) => manualStates.push(state),
304
- });
305
-
306
- rejectCheck(new Error("offline"));
307
- await Promise.all([launchCheck, manualCheck]);
308
-
309
- expect(client.checkForUpdateAsync).toHaveBeenCalledOnce();
310
- expect(failures).toEqual(["offline"]);
311
- expect(manualStates).toEqual(["checking", "idle"]);
312
- reportError.mockRestore();
313
- });
314
-
261
it("publishes the in-flight check before a state callback can re-enter", async () => {
262
let resolveCheck!: (result: {
263
readonly isAvailable: boolean;
apps/mobile/src/features/usage/usageEnvironmentSelection.test.ts
-4
@@ -16,10 +16,6 @@ describe("usage environment selection", () => {
16
expect(toggleUsageEnvironment(selected, environments, b)).toBeNull();
17
});
18
19
- it("can deselect the last environment", () => {
20
- expect(toggleUsageEnvironment(new Set([a]), environments, a)).toEqual(new Set());
21
- });
22
-
19
it("does not count removed IDs toward selecting all current environments", () => {
20
expect(toggleUsageEnvironment(new Set([a, removed]), environments, b)).toEqual(new Set([a, b]));
21
});
apps/mobile/src/features/workspace/android-workspace-navigation-colors.test.ts
+1
-1
@@ -48,7 +48,7 @@ describe("Android workspace navigation colors", () => {
48
},
49
);
50
51
- it.each(["#6750a4", "#006a6a", "#9c4146"])(
51
+ it.each(["#6750a4", "#9c4146"])(
52
"keeps Material You selection visible for system seed %s",
53
(seed) => {
54
for (const appearance of ["light", "dark"] as const) {
apps/mobile/src/lib/android-workspace-navigation.test.ts
+12
-35
@@ -110,18 +110,6 @@ describe("Android workspace navigation", () => {
110
expect(names(apply(second, StackActions.pop()))).toEqual(["Home"]);
111
});
112
113
- it("dismisses nested content and overlays when the sidebar selects a peer", () => {
114
- let state = legacyHistory();
115
- state = apply(
116
- state,
117
- StackActions.push("PullRequestFile", { ...pullRequest.params, path: "src/main.ts" }),
118
- );
119
- state = apply(state, StackActions.push("SettingsSheet"));
120
- const selected = select(state, thread);
121
- expect(names(selected)).toEqual(["Home", "Thread"]);
122
- expect(selected.routes[1]?.params).toEqual(thread.params);
123
- });
124
-
113
it("creates Home beneath cold-linked details and gives direct list escape", () => {
114
const initial = router.getInitialState(options);
115
const cold = apply(initial, CommonActions.reset({ index: 0, routes: [pullRequest] }));
@@ -149,21 +137,18 @@ describe("Android workspace navigation", () => {
137
},
138
);
139
152
- it.each([
153
- { environmentId: "environment-b" },
154
- { projectId: "project-b" },
155
- { repository: "owner/other" },
156
- { host: "git.example.test" },
157
- { number: 43 },
158
- ])("does not reuse another PR's key when its scope differs: %o", (change) => {
159
- const previous = select(router.getInitialState(options), pullRequest);
160
- const state = select(previous, {
161
- name: "PullRequest",
162
- params: { ...pullRequest.params, ...change },
163
- });
164
- expect(state.routes[1]?.key).not.toBe(previous.routes[1]?.key);
165
- expect(state.routes[1]?.params).toEqual({ ...pullRequest.params, ...change });
166
- });
140
+ it.each([{ environmentId: "environment-b" }, { repository: "owner/other" }])(
141
+ "does not reuse another PR's key when its scope differs: %o",
142
+ (change) => {
143
+ const previous = select(router.getInitialState(options), pullRequest);
144
+ const state = select(previous, {
145
+ name: "PullRequest",
146
+ params: { ...pullRequest.params, ...change },
147
+ });
148
+ expect(state.routes[1]?.key).not.toBe(previous.routes[1]?.key);
149
+ expect(state.routes[1]?.params).toEqual({ ...pullRequest.params, ...change });
150
+ },
151
+ );
152
153
it("returns to a distinct previous thread, otherwise to the workspace list", () => {
154
const parent = select(router.getInitialState(options), thread);
@@ -238,14 +223,6 @@ describe("Android workspace navigation", () => {
223
).toBe(false);
224
});
225
241
- it("drops stale detail history on a tab switch while retaining Home", () => {
242
- const previous = legacyHistory();
243
- const state = select(previous);
244
- expect(names(state)).toEqual(["Home"]);
245
- expect(state.routes[0]?.key).toBe(previous.routes[0]?.key);
246
- expect(state.index).toBe(0);
247
- });
248
-
226
it("resets the root stack when a nested Settings stack has focus", () => {
227
const root = apply(router.getInitialState(options), StackActions.push("SettingsSheet"));
228
const settings = router.getInitialState({
apps/mobile/src/lib/attachmentDownload.test.ts
-38
@@ -72,7 +72,6 @@ vi.mock("./uuid", () => ({ uuidv4: mocks.uuid }));
72
vi.mock("./shareFileFromSource", () => ({ shareFileFromSource: mocks.shareFromSource }));
73
74
import {
75
- openAttachmentInViewer,
75
downloadAndShareAttachment,
76
downloadAttachmentForPreview,
77
shareLocalAttachment,
@@ -137,12 +136,8 @@ describe("downloadAndShareAttachment", () => {
136
it.each([
137
["../../résumé.pdf", "résumé.pdf"],
138
["C:\\folder\\clip.mp4", "clip.mp4"],
140
- ["a?query#part%2F.txt", "a?query#part%2F.txt"],
141
- ["Report #5 - 100%.pdf", "Report #5 - 100%.pdf"],
139
["..", "attachment"],
143
- [" ", "attachment"],
140
["\ud800file\u0000.txt", "_file_.txt"],
145
- [".env", ".env"],
141
])("uses a safe basename for %j", async (name, expected) => {
142
await downloadAndShareAttachment({
143
...input,
@@ -192,23 +187,6 @@ describe("downloadAndShareAttachment", () => {
187
expect(mocks.share).not.toHaveBeenCalled();
188
});
189
195
- it("does not open a late download after cancellation", async () => {
196
- const started = Promise.withResolvers<{ uri: string }>();
197
- const download = Promise.withResolvers<{ uri: string }>();
198
- mocks.download.mockImplementation((_url: string, file: { uri: string }) => {
199
- started.resolve(file);
200
- return download.promise;
201
- });
202
- const controller = new AbortController();
203
- const task = downloadAndShareAttachment({ ...input, signal: controller.signal });
204
- const file = await started.promise;
205
- controller.abort();
206
- download.resolve(file);
207
- await task;
208
- expect(mocks.share).not.toHaveBeenCalled();
209
- expect(mocks.deleted).toHaveBeenCalledTimes(1);
210
- });
211
-
190
it("retains an export when its row unmounts during the native handoff", async () => {
191
const opened = Promise.withResolvers<void>();
192
const share = Promise.withResolvers<void>();
@@ -366,19 +344,3 @@ describe("attachment preview files", () => {
344
expect(mocks.deleted).toHaveBeenCalledTimes(1);
345
});
346
});
369
-
370
-describe("document viewer handoff", () => {
371
- it("cleans up when no viewer handles the document", async () => {
372
- mocks.open.mockRejectedValue(new Error("No viewer"));
373
- await expect(
374
- openAttachmentInViewer({
375
- uri: input.url,
376
- attachment: input.attachment,
377
- signal: new AbortController().signal,
378
- }),
379
- ).rejects.toThrow("No viewer");
380
- expect(mocks.download).toHaveBeenCalledTimes(1);
381
- expect(mocks.deleted).toHaveBeenCalledTimes(1);
382
- expect(isForegroundHandoffActive()).toBe(false);
383
- });
384
-});
apps/mobile/src/lib/attachmentUpload.test.ts
+3
-60
@@ -139,10 +139,6 @@ const documentPickedImage = {
139
} as const satisfies DraftComposerAttachment;
140
141
describe("validateDraftFileAttachments", () => {
142
- it("allows legacy image-only sends without server config", () => {
143
- expect(validateDraftFileAttachments({ attachments: [image], serverConfig: null })).toBeNull();
144
- });
145
-
142
it("blocks files while config is unknown or file uploads are unsupported", () => {
143
expect(validateDraftFileAttachments({ attachments: [file], serverConfig: null })).toBe(
144
"Server attachment support is still loading.",
@@ -294,24 +290,6 @@ describe("prepareTurnAttachments", () => {
290
expect(mocks.runAtomCommand).toHaveBeenCalledTimes(1);
291
});
292
297
- it("keeps existing image attachments on the legacy wire path", async () => {
298
- const prepared = await prepareTurnAttachments({ environmentId, attachments: [image] });
299
-
300
- expect(prepared.status).toBe("ready");
301
- if (prepared.status !== "ready") return;
302
- expect(prepared.attachments).toEqual([
303
- {
304
- type: "image",
305
- name: "screenshot.png",
306
- mimeType: "image/png",
307
- sizeBytes: 3,
308
- dataUrl: "data:image/png;base64,YWJj",
309
- },
310
- ]);
311
- expect(prepared.pendingAttachmentIds).toEqual([]);
312
- expect(mocks.upload).not.toHaveBeenCalled();
313
- });
314
-
293
it("inlines a file-backed image lazily when the server lacks image uploads", async () => {
294
const prepared = await prepareTurnAttachments({
295
environmentId,
@@ -333,6 +311,7 @@ describe("prepareTurnAttachments", () => {
311
expect(mocks.upload).not.toHaveBeenCalled();
312
});
313
314
+ // regression: #9713 read file-backed image drafts before enabling them
315
it("reads restored images from the current iOS document container for legacy sends", async () => {
316
const fileName = "33333333-3333-4333-8333-333333333333-photo.png";
317
mocks.documentUri =
@@ -348,6 +327,7 @@ describe("prepareTurnAttachments", () => {
327
);
328
});
329
330
+ // regression: #9713 read file-backed image drafts before enabling them
331
it("rejects a legacy image without inline bytes or a file", async () => {
332
const { fileUri: _, ...missingImage } = fileBackedImage;
333
await expect(
@@ -379,6 +359,7 @@ describe("prepareTurnAttachments", () => {
359
},
360
);
361
362
+ // regression: #9713 read file-backed image drafts before enabling them
363
it("uploads a file-backed image from its owned copy without staging base64", async () => {
364
const prepared = await prepareTurnAttachments({
365
environmentId,
@@ -542,30 +523,6 @@ describe("prepareTurnAttachments", () => {
523
]);
524
});
525
545
- it("keeps the uploaded id when a document-picked picture uploads as an image", () => {
546
- expect(
547
- withUploadedMobileAttachmentReferences({
548
- environmentId,
549
- attachments: [documentPickedImage],
550
- uploadedAttachments: [
551
- {
552
- type: "image",
553
- id: "pending-promoted-png",
554
- name: documentPickedImage.name,
555
- mimeType: "image/png",
556
- sizeBytes: documentPickedImage.sizeBytes,
557
- },
558
- ],
559
- }),
560
- ).toEqual([
561
- {
562
- ...documentPickedImage,
563
- uploadedAttachmentId: "pending-promoted-png",
564
- uploadEnvironmentId: environmentId,
565
- },
566
- ]);
567
- });
568
-
526
it("reuses a pending file upload from a previous outbox attempt", async () => {
527
const previouslyUploaded = {
528
...file,
@@ -775,20 +732,6 @@ describe("prepareTurnAttachments", () => {
732
expect(result.status).toBe("abandoned");
733
expect(removeCallsFor(MINTED_ID)).toBe(1);
734
});
778
-
779
- it("deletes the minted uploads when persisting the references throws", async () => {
780
- await expect(
781
- prepareTurnAttachments({
782
- environmentId,
783
- attachments: [file],
784
- persistUploadedReferences: async () => {
785
- throw new Error("draft write failed");
786
- },
787
- }),
788
- ).rejects.toThrow("draft write failed");
789
-
790
- expect(removeCallsFor(MINTED_ID)).toBe(1);
791
- });
735
});
736
737
describe("releasePendingAttachmentUploads", () => {
apps/mobile/src/lib/composerContextClipboard.test.ts
+1
@@ -244,6 +244,7 @@ describe("mobile context clipboard imports", () => {
244
expect(mocks.download).not.toHaveBeenCalled();
245
});
246
247
+ // regression: #18322 don't send or paste attached threads a machine can't read
248
it("reports foreign threads and failed files together while keeping the rest of a paste", async () => {
249
mocks.download.mockRejectedValueOnce(new Error("source disconnected"));
250
const result = await importComposerContextClipboard(
apps/mobile/src/lib/composerFiles.test.ts
+2
-60
@@ -222,6 +222,7 @@ describe("composer file attachments", () => {
222
expect(result.images).toEqual([expect.objectContaining({ mimeType: "image/jpeg" })]);
223
});
224
225
+ // regression: #11440 render photo library picks to a bounded JPEG off the JS thread
226
it("renders a supported original whose size cannot be measured", async () => {
227
mocks.pickMedia.mockResolvedValue({
228
canceled: false,
@@ -265,6 +266,7 @@ describe("composer file attachments", () => {
266
expect(result.error).toBe("Failed to read 'missing.gif'.");
267
});
268
269
+ // regression: #11440 render photo library picks to a bounded JPEG off the JS thread
270
it("reports a photo the native renderer cannot decode", async () => {
271
mocks.manipulate.mockImplementation(() => ({
272
resize: () => {
@@ -371,13 +373,6 @@ describe("composer file attachments", () => {
373
});
374
375
it.each([
374
- {
375
- reason: "picker size exceeds the server limit",
376
- reported: 2 * 1024 * 1024,
377
- stored: 42,
378
- limit: 1024 * 1024,
379
- error: "'clip.mov' exceeds the 1 MB attachment limit.",
380
- },
376
{
377
reason: "actual size exceeds the server limit",
378
reported: 42,
@@ -563,18 +558,6 @@ describe("composer file attachments", () => {
558
expect(mocks.open).not.toHaveBeenCalled();
559
});
560
566
- it("reports picker failures and releases the foreground handoff", async () => {
567
- mocks.pickFile.mockRejectedValue(new Error("The document provider is unavailable."));
568
-
569
- await expect(pickComposerFiles({ existingCount: 0 })).resolves.toEqual({
570
- files: [],
571
- error: "The document provider is unavailable.",
572
- });
573
-
574
- expect(isForegroundHandoffActive()).toBe(false);
575
- expect(mocks.copy).not.toHaveBeenCalled();
576
- });
577
-
561
it("does not open the picker when the draft has no remaining attachment slots", async () => {
562
await expect(pickComposerFiles({ existingCount: 100 })).resolves.toEqual({
563
files: [],
@@ -605,27 +588,6 @@ describe("composer file attachments", () => {
588
expect(mocks.copy).not.toHaveBeenCalled();
589
});
590
608
- it("never accepts files above the 50 MB contract limit", async () => {
609
- mocks.pickFile.mockResolvedValue({
610
- canceled: false,
611
- assets: [
612
- {
613
- uri: "file:///downloads/archive.zip",
614
- name: "archive.zip",
615
- mimeType: "application/zip",
616
- size: 51 * 1024 * 1024,
617
- },
618
- ],
619
- });
620
-
621
- await expect(
622
- pickComposerFiles({ existingCount: 0, maxBytes: 80 * 1024 * 1024 }),
623
- ).resolves.toEqual({
624
- files: [],
625
- error: "'archive.zip' exceeds the 50 MB attachment limit.",
626
- });
627
- });
628
-
591
it("rejects a file that grew after the picker reported its size", async () => {
592
mocks.pickFile.mockResolvedValue({
593
canceled: false,
@@ -691,26 +653,6 @@ describe("composer file attachments", () => {
653
);
654
});
655
694
- it("reports an empty file without calling it oversized", async () => {
695
- mocks.size.mockReturnValue(0);
696
- mocks.pickFile.mockResolvedValue({
697
- canceled: false,
698
- assets: [
699
- {
700
- uri: "file:///downloads/empty.txt",
701
- name: "empty.txt",
702
- mimeType: "text/plain",
703
- size: 0,
704
- },
705
- ],
706
- });
707
-
708
- await expect(pickComposerFiles({ existingCount: 0 })).resolves.toEqual({
709
- files: [],
710
- error: "'empty.txt' is empty or could not be read.",
711
- });
712
- });
713
-
656
it.each([0, undefined])("copies an Android SAF file when the picker size is %s", async (size) => {
657
const reader = {
658
readBytes: vi
apps/mobile/src/lib/composerImages.test.ts
+1
-66
@@ -103,12 +103,7 @@ vi.mock("./uuid", () => ({
103
uuidv4: () => "attachment-id",
104
}));
105
106
-import {
107
- convertPastedImagesToAttachments,
108
- createPastedTextComposerAttachment,
109
- isOwnedPastedImageUri,
110
- pasteComposerClipboard,
111
-} from "./composerImages";
106
+import { convertPastedImagesToAttachments, pasteComposerClipboard } from "./composerImages";
107
108
describe("composer clipboard paste", () => {
109
beforeEach(() => {
@@ -195,16 +190,6 @@ describe("native pasted image cleanup", () => {
190
files.clear();
191
});
192
198
- it("recognizes only files created in the native composer paste directory", () => {
199
- expect(
200
- isOwnedPastedImageUri(
201
- "file:///private/var/mobile/Containers/Data/Application/app/tmp/t3-composer-paste/id.png",
202
- ),
203
- ).toBe(true);
204
- expect(isOwnedPastedImageUri("file:///private/var/mobile/photos/id.png")).toBe(false);
205
- expect(isOwnedPastedImageUri("https://example.com/t3-composer-paste/id.png")).toBe(false);
206
- });
207
-
193
it("converts owned files to data-backed previews and deletes the source", async () => {
194
const uri =
195
"file:///private/var/mobile/Containers/Data/Application/app/tmp/t3-composer-paste/id.png";
@@ -243,26 +228,6 @@ describe("native pasted image cleanup", () => {
228
expect(files.get(overflow)?.deleted).toBe(true);
229
expect(files.get(userOwned)?.deleted).toBe(false);
230
});
246
-
247
- it("persists folded text unchanged in the app-owned attachment directory", async () => {
248
- const text = "first line\nUnicode: 🙂\n";
249
- const attachment = await createPastedTextComposerAttachment({
250
- text,
251
- name: "pasted-text.txt",
252
- maxBytes: 1024,
253
- });
254
-
255
- expect(attachment).toEqual({
256
- id: "attachment-id",
257
- type: "file",
258
- name: "pasted-text.txt",
259
- mimeType: "text/plain;charset=utf-8",
260
- sizeBytes: new TextEncoder().encode(text).byteLength,
261
- fileUri: "file:///documents/t3-composer-attachments/attachment-id-pasted-text.txt",
262
- source: { _tag: "pasted-text" },
263
- });
264
- expect(files.get(attachment.fileUri)?.text).toBe(text);
265
- });
231
});
232
233
describe("composerStripAttachments", () => {
@@ -298,34 +263,4 @@ describe("composerStripAttachments", () => {
263
"vid-1",
264
]);
265
});
301
-
302
- it("treats a picture picked through the document picker as media", async () => {
303
- const { composerStripAttachments } = await import("./composerImages");
304
- const pickedImage = {
305
- id: "pick-1",
306
- type: "file" as const,
307
- name: "photo.png",
308
- mimeType: "image/png",
309
- sizeBytes: 30,
310
- fileUri: "file:///photo.png",
311
- };
312
- expect(composerStripAttachments([pickedImage] as never).map((a) => a.id)).toEqual(["pick-1"]);
313
- });
314
-});
315
-
316
-describe("composerAttachmentInlineUri", () => {
317
- it("offers the inline bytes of a picture that owns no file", async () => {
318
- const { composerAttachmentInlineUri } = await import("./composerImages");
319
- expect(
320
- composerAttachmentInlineUri({
321
- id: "img-1",
322
- type: "image",
323
- name: "IMG_0111.jpg",
324
- mimeType: "image/jpeg",
325
- sizeBytes: 9_100_000,
326
- dataUrl: "data:image/jpeg;base64,AAAA",
327
- previewUri: "ph://asset",
328
- } as never),
329
- ).toBe("data:image/jpeg;base64,AAAA");
330
- });
266
});
apps/mobile/src/lib/connection.test.ts
+1
-6
@@ -1,7 +1,7 @@
1
import { afterEach, describe, expect, it, vi } from "vite-plus/test";
2
import { EnvironmentId } from "@t3tools/contracts";
3
4
-import { isRelayManagedConnection, toStableSavedRemoteConnection } from "./connection";
4
+import { toStableSavedRemoteConnection } from "./connection";
5
6
const mobilePlatform = vi.hoisted(() => ({ OS: "ios" as "ios" | "android" }));
7
const mobileDevice = vi.hoisted(() => ({
@@ -37,11 +37,6 @@ describe("mobile remote connection records", () => {
37
mobileDevice.modelName = "iPhone 15 Pro";
38
});
39
40
- it("keeps existing DPoP tunnel records read-only after upgrading", () => {
41
- expect(isRelayManagedConnection({ authenticationMethod: "dpop" })).toBe(true);
42
- expect(isRelayManagedConnection({ authenticationMethod: "bearer" })).toBe(false);
43
- });
44
-
40
it("drops short-lived managed environment credentials from stable records", () => {
41
const connection = {
42
environmentId: EnvironmentId.make("environment-1"),
apps/mobile/src/lib/copyTextWithHaptic.test.ts
deleted
-61
@@ -1,61 +0,0 @@
1
-import { afterEach, beforeEach, describe, expect, it, vi } from "vite-plus/test";
2
-
3
-const mocks = vi.hoisted(() => ({
4
- impactAsync: vi.fn(),
5
- selectionAsync: vi.fn(),
6
- setStringAsync: vi.fn(),
7
-}));
8
-
9
-vi.mock("expo-clipboard", () => ({
10
- setStringAsync: mocks.setStringAsync,
11
-}));
12
-
13
-vi.mock("expo-haptics", () => ({
14
- ImpactFeedbackStyle: {
15
- Light: "light",
16
- },
17
- impactAsync: mocks.impactAsync,
18
- selectionAsync: mocks.selectionAsync,
19
-}));
20
-
21
-import { tryCopyTextWithHaptic } from "./copyTextWithHaptic";
22
-
23
-describe("copyTextWithHaptic", () => {
24
- beforeEach(() => {
25
- vi.clearAllMocks();
26
- mocks.setStringAsync.mockReturnValue(new Promise<void>(() => undefined));
27
- mocks.impactAsync.mockResolvedValue(undefined);
28
- mocks.selectionAsync.mockResolvedValue(undefined);
29
- });
30
-
31
- afterEach(() => {
32
- vi.restoreAllMocks();
33
- });
34
-
35
- it("reports structured failures without including clipboard contents", async () => {
36
- const content = "https://accounts.google.com/auth?state=private-state&code=private-code";
37
- const clipboardCause = new Error(`Cannot copy ${content}`);
38
- const hapticCause = new Error(`Native failure for ${content}`);
39
- const consoleError = vi.spyOn(console, "error").mockImplementation(() => undefined);
40
- mocks.setStringAsync.mockRejectedValueOnce(clipboardCause);
41
- mocks.impactAsync.mockRejectedValueOnce(hapticCause);
42
-
43
- await tryCopyTextWithHaptic(content, { target: "provider-sign-in-link" });
44
-
45
- expect(consoleError).toHaveBeenCalledWith(
46
- "Failed to copy provider-sign-in-link to the clipboard.",
47
- expect.objectContaining({
48
- _tag: "CopyTextClipboardWriteError",
49
- target: "provider-sign-in-link",
50
- }),
51
- );
52
- expect(consoleError).toHaveBeenCalledWith(
53
- "Failed to trigger light-impact haptic feedback after copying provider-sign-in-link.",
54
- expect.objectContaining({ _tag: "CopyTextHapticFeedbackError", feedback: "light-impact" }),
55
- );
56
- const diagnostics = JSON.stringify(consoleError.mock.calls);
57
- expect(diagnostics).not.toContain("private-state");
58
- expect(diagnostics).not.toContain("private-code");
59
- expect(diagnostics).not.toContain("cause");
60
- });
61
-});
apps/mobile/src/lib/enrichedLinkPresentation.test.ts
-31
@@ -1,7 +1,5 @@
1
import { describe, expect, it } from "vite-plus/test";
2
-import type { ComposerContextId, ReviewCommentContextRecord } from "@t3tools/contracts";
2
import {
4
- enrichedContextLinkPresentation,
3
enrichedLinkVariantPattern,
4
enrichedSkillLinkRegex,
5
ENRICHED_INLINE_FILE_LINK_REGEX,
@@ -48,33 +46,4 @@ describe("Enriched link presentation", () => {
46
expect(pattern.test(`${url}/child`)).toBe(false);
47
expect(pattern.test("file:///workspace/app1Xtsx?line=34")).toBe(false);
48
});
51
-
52
- it("uses context identity for PR status even when labels are identical", () => {
53
- const record: ReviewCommentContextRecord = {
54
- version: 1,
55
- contextId: "review_1" as ComposerContextId,
56
- kind: "review-comment",
57
- label: "Review",
58
- sectionId: "pull-request:7",
59
- sectionTitle: "Review",
60
- filePath: "app.tsx",
61
- startIndex: 0,
62
- endIndex: 1,
63
- rangeLabel: "line 1",
64
- text: "Comment",
65
- diff: "",
66
- pullRequest: {
67
- number: 7,
68
- title: "Review",
69
- url: "https://github.com/example/repo/pull/7",
70
- headBranch: "feature",
71
- baseBranch: "main",
72
- state: "merged",
73
- isDraft: false,
74
- },
75
- };
76
- expect(
77
- enrichedContextLinkPresentation("t3-context://v1/review-comment/review_1", [record]),
78
- ).toEqual({ accent: "#8a70dd", icon: { kind: "chip", name: "git-merge" } });
79
- });
49
});
apps/mobile/src/lib/filePreview.test.ts
-3
@@ -4,12 +4,9 @@ import { isPdfFile } from "./filePreview";
4
5
describe("PDF preview detection", () => {
6
it.each([
7
- [{ name: "download", mimeType: "application/pdf" }, true],
7
[{ name: "download", mimeType: "APPLICATION/PDF; charset=binary" }, true],
9
- [{ name: "Report.PDF", mimeType: "application/octet-stream" }, true],
8
[{ name: "https://example.com/report.pdf?signature=abc#page=2" }, true],
9
[{ name: "report.pdf", mimeType: "text/plain" }, false],
12
- [{ name: "report.pdf.exe" }, false],
10
[{ name: "https://example.com/page?download=report.pdf" }, false],
11
])("classifies %j as %s", (file, expected) => {
12
expect(isPdfFile(file)).toBe(expected);
apps/mobile/src/lib/layout.test.ts
+2
-19
@@ -12,7 +12,6 @@ import {
12
describe("thread work-log text sizing", () => {
13
it.each([
14
{ baseFontSize: 16, fontScale: 1.25, estimatedRowHeight: 28 },
15
- { baseFontSize: 16, fontScale: 2, estimatedRowHeight: 38 },
15
{ baseFontSize: 22, fontScale: 2, estimatedRowHeight: 52 },
16
])(
17
"measures accessibility text instead of locking it to the estimate: %j",
@@ -38,6 +37,7 @@ describe("thread work-log text sizing", () => {
37
});
38
39
describe("deriveThreadFeedInitialContentInset", () => {
40
+ // regression: #5585 land the first thread open above the composer on Android
41
it("does not double native iOS insets", () => {
42
expect(
43
deriveThreadFeedInitialContentInset({
@@ -50,6 +50,7 @@ describe("deriveThreadFeedInitialContentInset", () => {
50
});
51
52
describe("isPrimarySidebarPinned", () => {
53
+ // regression: #20406 sidebar toggle works on iPad and iPhone Duo
54
it("keeps compact native roots pinned so search cannot hide the sidebar for a later split", () => {
55
expect(
56
isPrimarySidebarPinned({ pathname: "/", nativeWorkspace: true, usesSplitView: false }),
@@ -75,24 +76,6 @@ describe("deriveWorkspacePaneLayout", () => {
76
auxiliaryPaneVisible: true,
77
});
78
});
78
-
79
- it("restores the thread sidebar when the file inspector is hidden", () => {
80
- const layout = deriveLayout({ width: 1_024, height: 1_366 });
81
-
82
- expect(
83
- deriveWorkspacePaneLayout({
84
- layout,
85
- viewportWidth: 1_024,
86
- primarySidebarPreferredVisible: true,
87
- auxiliaryPanePreferredVisible: false,
88
- auxiliaryPaneRole: "inspector",
89
- }),
90
- ).toMatchObject({
91
- primarySidebarVisible: true,
92
- primarySidebarSuppressedByAuxiliary: false,
93
- auxiliaryPaneVisible: false,
94
- });
95
- });
79
});
80
81
describe("alignListPaneToHinge", () => {
apps/mobile/src/lib/markdownHtml.test.ts
-8
@@ -3,14 +3,6 @@ import { markdownHtmlContent, markdownWithHtml, parseMarkdownDocument } from "./
3
import { markdownImageSources } from "./markdownImageSources";
4
5
describe("HTML in native Markdown", () => {
6
- it("leaves code inside an HTML details block literal", () => {
7
- const content =
8
- '<details>\n<summary>Example</summary>\n\n```html\n<img src="literal.png">\n```\n\nUse `<img>` here.\n</details>';
9
- const result = markdownHtmlContent(content);
10
- expect(result).toContain('```html\n<img src="literal.png">\n```');
11
- expect(result).toContain("Use `<img>` here.");
12
- expect(result).not.toContain("<details>");
13
- });
6
it("preserves screenshot URLs and captions from GitHub HTML image embeds", () => {
7
expect(
8
markdownHtmlContent(
apps/mobile/src/lib/markdownLinks.test.ts
+2
-22
@@ -1,17 +1,6 @@
1
import { describe, expect, it } from "vite-plus/test";
2
3
-import { resolveMarkdownLinkIcon, resolveMarkdownLinkPresentation } from "./markdownLinks";
4
-
5
-describe("resolveMarkdownLinkIcon", () => {
6
- it("gives GitHub hosts the brand mark and everything else the generic glyph", () => {
7
- expect(resolveMarkdownLinkIcon("github.com")).toBe("github");
8
- expect(resolveMarkdownLinkIcon("GitHub.com")).toBe("github");
9
- expect(resolveMarkdownLinkIcon("gist.github.com")).toBe("github");
10
- expect(resolveMarkdownLinkIcon("github.community")).toBeNull();
11
- expect(resolveMarkdownLinkIcon("notgithub.com")).toBeNull();
12
- expect(resolveMarkdownLinkIcon("example.com")).toBeNull();
13
- });
14
-});
3
+import { resolveMarkdownLinkPresentation } from "./markdownLinks";
4
5
describe("resolveMarkdownLinkPresentation", () => {
6
it("opens relative directory links as workspace paths", () => {
@@ -81,6 +70,7 @@ describe("resolveMarkdownLinkPresentation", () => {
70
});
71
});
72
73
+ // regression: #8098 open agent file links in the file viewer
74
it("recognizes spaced relative paths", () => {
75
expect(resolveMarkdownLinkPresentation("docs/My%20Folder/checklist.xml")).toMatchObject({
76
kind: "file",
@@ -89,16 +79,6 @@ describe("resolveMarkdownLinkPresentation", () => {
79
});
80
});
81
92
- it("extracts line fragments from relative file links", () => {
93
- expect(resolveMarkdownLinkPresentation("src/main.ts#L18C2")).toMatchObject({
94
- kind: "file",
95
- path: "src/main.ts",
96
- line: 18,
97
- column: 2,
98
- label: "main.ts · L18:C2",
99
- });
100
- });
101
-
82
it("does not style app routes as file links", () => {
83
expect(resolveMarkdownLinkPresentation("/chat/settings")).toEqual({
84
kind: "link",
apps/mobile/src/lib/markdownMedia.test.ts
+1
-1
@@ -69,7 +69,7 @@ describe("resolveMarkdownMediaPreview", () => {
69
});
70
});
71
72
- it.each(["./image.png", "./clip.mp4", "./report.pdf"])(
72
+ it.each(["./image.png", "./report.pdf"])(
73
"uses the draft workspace when no thread exists: %s",
74
(href) => {
75
expect(
apps/mobile/src/lib/materialYouTheme.test.ts
deleted
-49
@@ -1,49 +0,0 @@
1
-import { describe, expect, it } from "vite-plus/test";
2
-
3
-import { getMobileThemeRuntimeVariables } from "./mobileThemeVariables";
4
-import type { MaterialYouPalette } from "./materialYouPalette";
5
-import { materialYouPaletteToMobileThemeVariables } from "./materialYouTheme.android";
6
-
7
-const palette: MaterialYouPalette = {
8
- primary: "#6750A4FF",
9
- onPrimary: "#FFFFFFFF",
10
- primaryContainer: "#EADDFFFF",
11
- onPrimaryContainer: "#21005DFF",
12
- inversePrimary: "#D0BCFFFF",
13
- secondaryContainer: "#E8DEF8FF",
14
- onSecondaryContainer: "#1D192BFF",
15
- tertiary: "#7D5260FF",
16
- tertiaryContainer: "#FFD8E4FF",
17
- onTertiaryContainer: "#31111DFF",
18
- surface: "#FFFBFEFF",
19
- onSurface: "#1C1B1FFF",
20
- onSurfaceVariant: "#49454FFF",
21
- surfaceContainer: "#F3EDF7FF",
22
- surfaceContainerHigh: "#ECE6F0FF",
23
- surfaceContainerHighest: "#E6E0E9FF",
24
- surfaceContainerLow: "#F7F2FAFF",
25
- surfaceContainerLowest: "#FFFFFFFF",
26
- errorContainer: "#F9DEDCFF",
27
- onErrorContainer: "#410E0BFF",
28
- outline: "#79747EFF",
29
- outlineVariant: "#CAC4D0FF",
30
- scrim: "#000000FF",
31
-};
32
-
33
-describe("Material You system colors", () => {
34
- it("overrides the selected theme without mutating its base variables", () => {
35
- const base = getMobileThemeRuntimeVariables("t3-code", "dark", "android");
36
- const snapshot = { ...base };
37
-
38
- const variables = materialYouPaletteToMobileThemeVariables(palette, "dark", base);
39
-
40
- expect(base).toEqual(snapshot);
41
- expect(variables["--color-screen"]).toBe(palette.surface);
42
- expect(variables["--color-thread-canvas"]).toBe(palette.surfaceContainerLow);
43
- expect(variables["--color-thread-selected"]).toBe(palette.surfaceContainer);
44
- expect(variables["--color-header"]).toBe(palette.surfaceContainerHigh);
45
- expect(variables["--color-grouped-card"]).toBe(palette.surfaceContainer);
46
- expect(variables["--color-primary"]).toBe(palette.primary);
47
- expect(variables["--color-placeholder"]).toBe("#1C1B1F9E");
48
- });
49
-});
apps/mobile/src/lib/mediaActions.test.ts
-18
@@ -178,21 +178,3 @@ it.each(["https://cdn.test/image.png", "file:///device/image.png"])(
178
expect(uri.startsWith("file:") ? state.shareLocal : state.download).toHaveBeenCalledOnce();
179
},
180
);
181
-
182
-it("shares device draft attachments without a host grant", async () => {
183
- await useMediaActions({
184
- attachment: {
185
- id: "draft",
186
- type: "file",
187
- fileUri: "file:///device/image.png",
188
- name: "image.png",
189
- mimeType: "image/png",
190
- sizeBytes: 1,
191
- },
192
- name: "image.png",
193
- mimeType: "image/png",
194
- }).share();
195
-
196
- expect(state.refresh).not.toHaveBeenCalled();
197
- expect(state.shareDraft).toHaveBeenCalledOnce();
198
-});
apps/mobile/src/lib/menu-action-colors.test.ts
deleted
-34
@@ -1,34 +0,0 @@
1
-import type { MenuAction } from "@react-native-menu/menu";
2
-import { describe, expect, it } from "vite-plus/test";
3
-
4
-import { withMenuActionIconColors } from "./menu-action-colors";
5
-
6
-describe("withMenuActionIconColors", () => {
7
- it.each(["#111111", "#eeeeee"])(
8
- "gives icons a visible color at every menu depth for the %s theme",
9
- (icon) => {
10
- const actions: MenuAction[] = [
11
- { id: "photos", title: "Photos", image: "photo" },
12
- {
13
- title: "Thread",
14
- subactions: [
15
- {
16
- title: "Pinned thread",
17
- image: "pin",
18
- subactions: [{ title: "Move up", image: "arrow.up" }],
19
- },
20
- ],
21
- },
22
- ];
23
-
24
- const result = withMenuActionIconColors(actions, { icon, destructiveIcon: "#ff0000" });
25
-
26
- expect(result[0]?.imageColor).toBe(icon);
27
- expect(result[1]).not.toHaveProperty("imageColor");
28
- expect(result[1]?.subactions?.[0]?.imageColor).toBe(icon);
29
- expect(result[1]?.subactions?.[0]?.subactions?.[0]?.imageColor).toBe(icon);
30
- expect(actions[0]).not.toHaveProperty("imageColor");
31
- expect(actions[1]?.subactions?.[0]).not.toHaveProperty("imageColor");
32
- },
33
- );
34
-});
apps/mobile/src/lib/mobileTheme.test.ts
-9
@@ -20,8 +20,6 @@ import {
20
DEFAULT_MOBILE_THEME_ID,
21
flattenThemeColor,
22
getMobileThemeVariables,
23
- normalizeMobileThemeId,
24
- normalizeMobileThemeMode,
23
resolveMobileThemeIds,
24
themeColorWithAlpha,
25
themeColorToNativeColor,
@@ -204,13 +202,6 @@ describe("mobile themes", () => {
202
}
203
});
204
207
- it("normalizes persisted theme preferences", () => {
208
- expect(normalizeMobileThemeId("ocean")).toBe("ocean");
209
- expect(normalizeMobileThemeId("missing-theme")).toBe(DEFAULT_MOBILE_THEME_ID);
210
- expect(normalizeMobileThemeMode("dark")).toBe("dark");
211
- expect(normalizeMobileThemeMode("sepia")).toBe("system");
212
- });
213
-
205
it("migrates one theme choice to both appearances and preserves independent choices", () => {
206
expect(resolveMobileThemeIds({ themeId: "grove" })).toEqual({
207
light: "grove",
apps/mobile/src/lib/mobileThemeRuntime.test.ts
-4
@@ -20,8 +20,4 @@ describe("mobileThemeRuntime", () => {
20
21
expect(operations).toEqual([]);
22
});
23
-
24
- it("does no native work when persistence echoes an already-applied state", () => {
25
- expect(createMobileThemeRuntimeOperations(initialState, initialState)).toEqual([]);
26
- });
23
});
apps/mobile/src/lib/modelOptions.test.ts
+1
-16
@@ -400,9 +400,7 @@ describe("mobile model options", () => {
400
401
it.each([
402
["disabled", { enabled: false }],
403
- ["uninstalled", { installed: false }],
403
["signed out", { auth: { status: "unauthenticated" } }],
405
- ["unavailable", { availability: "unavailable" }],
404
] as const)("keeps a %s provider's selection and known model details", (_state, update) => {
405
const unavailableConfig = {
406
...config,
@@ -624,20 +622,6 @@ describe("mobile model options", () => {
622
expect(buildModelOptions(configWith(settings), null, undefined, projectId)).toEqual([]);
623
});
624
627
- it("shows an instance the project enables even though the machine disables it", () => {
628
- const settings: ServerSettings = {
629
- ...DEFAULT_SERVER_SETTINGS,
630
- providerInstances: {
631
- [instanceId]: { driver: ProviderDriverKind.make("codex"), enabled: false },
632
- },
633
- projectSettingsOverrides: {
634
- [projectId]: { providerInstances: { [instanceId]: { enabled: true } } },
635
- },
636
- };
637
-
638
- expect(buildModelOptions(configWith(settings), null, undefined, projectId)).toHaveLength(1);
639
- });
640
-
625
it("hides a machine-disabled instance for a project with no override, even though another project's keep-alive left it running", () => {
626
const otherProjectId = ProjectId.make("project-b");
627
const settings: ServerSettings = {
@@ -806,6 +790,7 @@ describe("synchronized mobile model visibility", () => {
790
).toEqual(["second", "first", "custom"]);
791
});
792
793
+ // regression: #16816 sync model favorites and visibility across clients
794
it("keeps custom models visible and restores built-in models when the server clears hidden models", () => {
795
expect(
796
buildModelOptions(config, { instanceId: provider, model: "custom" }, provider, null).map(
apps/mobile/src/lib/openExternalUrl.test.ts
-30
@@ -18,36 +18,6 @@ afterEach(() => {
18
});
19
20
describe("tryOpenExternalUrl", () => {
21
- it("logs stable URL context without exposing the opening failure", async () => {
22
- const cause = new Error("browser-unavailable-secret-sentinel");
23
- openURL.mockRejectedValue(cause);
24
- const consoleError = vi.spyOn(console, "error").mockImplementation(() => undefined);
25
-
26
- await expect(
27
- tryOpenExternalUrl("https://github.com/pingdotgg/t3code/pull/1?token=secret", "pull-request"),
28
- ).resolves.toBe(false);
29
-
30
- expect(consoleError).toHaveBeenCalledTimes(1);
31
- const [message, attributes] = consoleError.mock.calls[0] ?? [];
32
- expect(message).toBe("Failed to open pull-request URL with the https scheme.");
33
- expect(attributes).toEqual(
34
- expect.objectContaining({
35
- _tag: "ExternalUrlOpenError",
36
- target: "pull-request",
37
- scheme: "https",
38
- host: "github.com",
39
- stack: expect.stringContaining("ExternalUrlOpenError"),
40
- }),
41
- );
42
- expect(attributes).not.toHaveProperty("url");
43
- expect(attributes).not.toHaveProperty("cause");
44
- const diagnosticText = [message, ...Object.values(attributes as Record<string, unknown>)]
45
- .map(String)
46
- .join("\n");
47
- expect(diagnosticText).not.toContain("token=secret");
48
- expect(diagnosticText).not.toContain("browser-unavailable-secret-sentinel");
49
- });
50
-
21
it("keeps provider sign-in URLs unchanged and out of failure logs", async () => {
22
const url =
23
"https://accounts.google.com/o/oauth2/v2/auth?state=private-state&code_challenge=private-challenge&redirect_uri=http%3A%2F%2F127.0.0.1%3A43123%2F";
apps/mobile/src/lib/protectedData.test.ts
-9
@@ -80,16 +80,7 @@ afterEach(async () => {
80
describe("protected storage startup", () => {
81
it.each([
82
{ launch: "background", state: "background", checkRejects: false },
83
- { launch: "inactive", state: "inactive", checkRejects: false },
84
- { launch: "unknown", state: "unknown", checkRejects: false },
85
- { launch: "unset", state: null, checkRejects: false },
83
{ launch: "background with a failed native check", state: "background", checkRejects: true },
87
- {
88
- launch: "background without a native check",
89
- state: "background",
90
- nativeCheckSupported: false,
91
- },
92
- { launch: "unknown without a native check", state: "unknown", nativeCheckSupported: false },
84
{ launch: "unset without a native check", state: null, nativeCheckSupported: false },
85
])(
86
"keeps a locked $launch launch usable after activation without rebuilding its runtime",
apps/mobile/src/lib/storage.test.ts
-23
@@ -138,14 +138,6 @@ describe("mobile connection storage", () => {
138
await expect(loadPreferences()).resolves.toEqual({ baseFontSize: 17 });
139
});
140
141
- it("persists Material You independently for each appearance", async () => {
142
- const themes = { lightThemeId: "material-you", darkThemeId: "ocean" } as const;
143
- await savePreferencesPatch(themes);
144
- await expect(loadPreferences()).resolves.toEqual(themes);
145
- await savePreferencesPatch({ lightThemeId: "t3-chat" });
146
- await expect(loadPreferences()).resolves.toEqual({ ...themes, lightThemeId: "t3-chat" });
147
- });
148
-
141
it("falls back to secure storage when SQLite cannot save preferences", async () => {
142
mocks.setDatabaseFailures(true, true);
143
await expect(savePreferencesPatch({ baseFontSize: 19 })).resolves.toEqual({ baseFontSize: 19 });
@@ -187,21 +179,6 @@ describe("mobile connection storage", () => {
179
expect(mocks.getStoredValue("t3code.preferences.fallback")).toBeNull();
180
});
181
190
- it("ignores an invalid fallback even when it has a newer timestamp", async () => {
191
- mocks.setPreferencesJson(JSON.stringify({ baseFontSize: 21 }), 30);
192
- await mocks.setItemAsync(
193
- "t3code.preferences.fallback",
194
- JSON.stringify({ payload: "{", updatedAt: 40 }),
195
- );
196
- const warn = vi.spyOn(console, "warn").mockImplementation(() => undefined);
197
-
198
- await expect(loadPreferences()).resolves.toEqual({ baseFontSize: 21 });
199
- expect(JSON.parse(mocks.getPreferencesJson() ?? "")).toEqual({ baseFontSize: 21 });
200
- expect(mocks.getStoredValue("t3code.preferences.fallback")).toBeNull();
201
-
202
- warn.mockRestore();
203
- });
204
-
182
it("keeps SQLite authoritative when stale legacy preferences remain", async () => {
183
mocks.setPreferencesJson(JSON.stringify({ baseFontSize: 21 }), 30);
184
await mocks.setItemAsync("t3code.preferences", JSON.stringify({ baseFontSize: 19 }));
apps/mobile/src/lib/threadActivity.test.ts
+1
@@ -463,6 +463,7 @@ describe("buildThreadFeed", () => {
463
]);
464
});
465
466
+ // regression: #21393 show plans and fold settled progress notes
467
it("folds progress even when a response has no tool calls", () => {
468
const feed = buildThreadFeed([
469
projected(userMessage(), 0),
apps/mobile/src/native/composerEditorRevision.test.ts
-6
@@ -8,12 +8,6 @@ import {
8
resolveComposerControlledEventCount,
9
} from "./composerEditorRevision";
10
11
-describe("acknowledgeComposerNativeEvent", () => {
12
- it("rejects events older than the latest native text revision", () => {
13
- expect(acknowledgeComposerNativeEvent(5, 4)).toBeNull();
14
- });
15
-});
16
-
11
describe("isComposerNativeEcho", () => {
12
const snapshots = [{ eventCount: 3, value: "native", selection: { start: 6, end: 6 } }];
13
apps/mobile/src/native/workspace-stack-projection.test.ts
+1
-3
@@ -88,9 +88,6 @@ describe("native workspace dismissal", () => {
88
expect(nativeWorkspacePopAction(state, settings.key)).toBeNull();
89
expect(nativeWorkspacePopAction(state, legal.key)).toBeNull();
90
});
91
- it("pops a native dismissed file while keeping the conversation and its draft mounted", () => {
92
- expect(nativeWorkspacePopCount(history([home, thread, files]), files.key)).toBe(1);
93
- });
91
92
it("removes the descendants when UIKit dismisses their parent conversation", () => {
93
expect(nativeWorkspacePopCount(history([home, thread, files]), thread.key)).toBe(2);
@@ -314,6 +311,7 @@ describe("v5 stack handoff", () => {
311
settings,
312
]);
313
});
314
+ // regression: #17231 keep native screens ordered during stack pops
315
it("retains a multi-page pop in order without changing the active router order", () => {
316
const replacement = { ...thread, key: "replacement" };
317
const screens = reconcileStackScreens([home, thread, files], [home, replacement]);
apps/mobile/src/persistence/mobile-database.test.ts
-17
@@ -27,23 +27,6 @@ describe("mobile database legacy cache migration", () => {
27
});
28
});
29
30
- it("preserves the old shell payload for schema decoding after migration", () => {
31
- const payload = JSON.stringify({
32
- schemaVersion: 1,
33
- environmentId: "environment-1",
34
- snapshotReceivedAt: "2026-07-01T00:00:00.000Z",
35
- snapshot: {},
36
- });
37
-
38
- expect(MobileDatabase.decodeLegacyCacheRecord("shell-snapshots", payload)).toEqual({
39
- environmentId: "environment-1",
40
- kind: "shell",
41
- cacheKey: "snapshot",
42
- schemaVersion: 1,
43
- payload,
44
- });
45
- });
46
-
30
it("skips malformed legacy records", () => {
31
expect(MobileDatabase.decodeLegacyCacheRecord("connection-vcs-refs", "{not-json")).toBeNull();
32
expect(
apps/mobile/src/persistence/mobile-storage.test.ts
+1
@@ -55,6 +55,7 @@ describe("mobile device identity", () => {
55
}),
56
);
57
58
+ // regression: #18837 serialize initial device identity creation
59
it.effect("reuses an existing device identity without generating or writing", () =>
60
Effect.gen(function* () {
61
values.set(deviceIdKey, "existing-device");
apps/mobile/src/reactCompilerCoverage.test.ts
-5
@@ -128,11 +128,6 @@ describe("React Compiler coverage", () => {
128
expect(transformed("false")).not.toContain("react/compiler-runtime");
129
});
130
131
- it("app.config.ts turns the compiler on for Metro", () => {
132
- const appConfig = NodeFS.readFileSync(NodePath.join(mobileRoot, "app.config.ts"), "utf8");
133
- expect(appConfig).toMatch(/experiments:\s*\{[^}]*reactCompiler:\s*true/);
134
- });
135
-
131
it.each(sourceFiles)("compiles %s", (file) => {
132
const bailouts = compilerBailouts(file);
133
if (file in KNOWN_BAILOUTS) {
apps/mobile/src/state/asset-url-state.test.ts
+1
@@ -18,6 +18,7 @@ describe("deriveAssetUrlState", () => {
18
}
19
});
20
21
+ // regression: #9123 show an error instead of an endless preview spinner
22
it("reports disconnected when the query failed while the environment is down", () => {
23
for (const connectionPhase of ["available", "offline", "reconnecting", "error"] as const) {
24
expect(deriveAssetUrlState({ connectionPhase, shared: { _tag: "Failure" } })).toEqual({
apps/mobile/src/state/composer-attachment-uploads.test.ts
+2
-4
@@ -293,7 +293,7 @@ function uploadState() {
293
];
294
}
295
296
-it.each(["decode", "read", "write"] as const)(
296
+it.each(["decode", "write"] as const)(
297
"keeps an accepted upload ready when the draft %s fails",
298
async (fault) => {
299
native.fault = fault;
@@ -318,12 +318,10 @@ it.each(["decode", "read", "write"] as const)(
318
},
319
);
320
321
-it.each(["http", "network", "permission"] as const)(
321
+it.each(["http", "permission"] as const)(
322
"keeps a real %s upload failure blocking Send",
323
async (failure) => {
324
if (failure === "http") native.transfer.mockResolvedValueOnce({ status: 503 });
325
- if (failure === "network")
326
- native.transfer.mockRejectedValueOnce(new Error("Network unavailable"));
325
if (failure === "permission") native.canOperate = false;
326
const queue = worker();
327
await queue.settled();
apps/mobile/src/state/pending-thread-creation.test.ts
-14
@@ -9,7 +9,6 @@ import {
9
import { describe, expect, it } from "vite-plus/test";
10
11
import {
12
- isPendingThreadCreationVisible,
12
resolvePendingThreadCreation,
13
type PendingThreadCreation,
14
} from "./pending-thread-creation";
@@ -139,16 +138,3 @@ describe("resolvePendingThreadCreation", () => {
138
).toBeNull();
139
});
140
});
142
-
143
-describe("isPendingThreadCreationVisible", () => {
144
- const creationMessageId = String(creation.messageId);
145
-
146
- it("stands down once the delivered prompt lands under the same id", () => {
147
- expect(
148
- isPendingThreadCreationVisible({
149
- creationMessageId,
150
- loadedMessageIds: ["someone-else", creationMessageId],
151
- }),
152
- ).toBe(false);
153
- });
154
-});
apps/mobile/src/state/queries.filesystem.test.ts
-16
@@ -74,19 +74,3 @@ it("keeps a file search pending until its grant loads, then shows matches", () =
74
isPending: false,
75
});
76
});
77
-
78
-it("shows a confirmed denial and a connection failure separately", () => {
79
- state.session = { authenticated: true, scopes: [] };
80
- expect(useComposerPathSearch(target)).toMatchObject({
81
- entries: [],
82
- error: "This connection cannot search host files.",
83
- isPending: false,
84
- });
85
- state.session = null;
86
- state.phase = "offline";
87
- expect(useComposerPathSearch(target)).toMatchObject({
88
- entries: [],
89
- error: "This environment is not connected.",
90
- isPending: false,
91
- });
92
-});
apps/mobile/src/state/thread-outbox.test.ts
-33
@@ -389,39 +389,6 @@ describe("thread outbox", () => {
389
).toBe("plan");
390
});
391
392
- it("serializes mutations even when an earlier mutation is slower", async () => {
393
- const registry = AtomRegistry.make();
394
- const manager = createThreadOutboxManager({
395
- registry,
396
- storage: {
397
- load: async () => ({ messages: [], errors: [] }),
398
- write: async () => undefined,
399
- remove: async () => undefined,
400
- },
401
- });
402
- const order: string[] = [];
403
- let releaseFirst!: () => void;
404
- const firstBlocked = new Promise<void>((resolve) => {
405
- releaseFirst = resolve;
406
- });
407
-
408
- const first = manager.serialize(async () => {
409
- order.push("first:start");
410
- await firstBlocked;
411
- order.push("first:end");
412
- });
413
- const second = manager.serialize(async () => {
414
- order.push("second");
415
- });
416
-
417
- await Promise.resolve();
418
- expect(order).toEqual(["first:start"]);
419
- releaseFirst();
420
- await Promise.all([first, second]);
421
- expect(order).toEqual(["first:start", "first:end", "second"]);
422
- registry.dispose();
423
- });
424
-
392
it("holds the mutation queue while persisted messages are loading", async () => {
393
const registry = AtomRegistry.make();
394
const message = queuedMessage({
apps/mobile/src/state/use-composer-drafts.test.ts
-154
@@ -191,7 +191,6 @@ import {
191
ensureComposerDraftsLoaded,
192
type ComposerDraft,
193
findNewTaskDraftKeys,
194
- findLocalComposerClipboardAttachment,
194
flushComposerDrafts,
195
getComposerDraftSnapshot,
196
mergeComposerDraftContentState,
@@ -616,49 +615,6 @@ describe("mobile composer drafts", () => {
615
]);
616
});
617
619
- it.each(["new-task:draft-1", "pending-task:queued-1"])(
620
- "finds draft-only local clipboard files in %s",
621
- (key) => {
622
- const environmentId = EnvironmentId.make("environment-1");
623
- const file = {
624
- type: "file" as const,
625
- id: "local-file",
626
- name: "notes.txt",
627
- mimeType: "text/plain",
628
- sizeBytes: 4,
629
- fileUri: "file:///notes.txt",
630
- };
631
- appAtomRegistry.set(composerDraftsAtom, {
632
- [key]: {
633
- text: "",
634
- attachments: [file],
635
- project: {
636
- environmentId,
637
- projectId: ProjectId.make("project-1"),
638
- createdAt: "2026-01-01T00:00:00.000Z",
639
- },
640
- },
641
- });
642
- appAtomRegistry.set(threadOutboxManager.queuedMessagesByThreadKeyAtom, {
643
- queued: [
644
- {
645
- environmentId,
646
- threadId: ThreadId.make("thread-1"),
647
- messageId: MessageId.make("queued-1"),
648
- commandId: CommandId.make("command-1"),
649
- text: "Queued",
650
- attachments: [],
651
- createdAt: "2026-01-01T00:00:00.000Z",
652
- },
653
- ],
654
- });
655
- expect(findLocalComposerClipboardAttachment(environmentId, file.id)).toEqual(file);
656
- expect(
657
- findLocalComposerClipboardAttachment(EnvironmentId.make("different-environment"), file.id),
658
- ).toBeUndefined();
659
- },
660
- );
661
-
618
it("keeps over-limit recovery context reloadable without losing other drafts", () => {
619
const key = "environment-1:recovery";
620
const merged = mergeComposerDraftContentState(
@@ -1023,48 +979,6 @@ describe("mobile composer drafts", () => {
979
expect(getComposerDraftSnapshot(draftKey).context).toBeUndefined();
980
});
981
1026
- // Hydration is one-shot per module instance and the attachment sweep now
1027
- // triggers it too, so this test must observe it before any sweep test runs.
1028
- it("hydrates generic file attachments from their saved local paths", () => {
1029
- const file = {
1030
- id: "file-1",
1031
- type: "file" as const,
1032
- name: "report.pdf",
1033
- mimeType: "application/pdf",
1034
- sizeBytes: 42,
1035
- fileUri: "file:///documents/report.pdf",
1036
- };
1037
-
1038
- expect(
1039
- decodePersistedComposerState({
1040
- schemaVersion: 1,
1041
- drafts: {
1042
- "environment-1:thread-1": { text: "Review this file", attachments: [file] },
1043
- },
1044
- }).drafts,
1045
- ).toEqual({
1046
- "environment-1:thread-1": {
1047
- text: "Review this file [report.pdf](t3-context://v1/file/file-1) ",
1048
- attachments: [file],
1049
- context: {
1050
- version: 1,
1051
- records: [
1052
- {
1053
- version: 1,
1054
- contextId: file.id,
1055
- kind: "file",
1056
- label: file.name,
1057
- attachmentId: file.id,
1058
- name: file.name,
1059
- mimeType: file.mimeType,
1060
- sizeBytes: file.sizeBytes,
1061
- },
1062
- ],
1063
- },
1064
- },
1065
- });
1066
- });
1067
-
982
it("releases videos rejected by the live draft limit and keeps accepted files", async () => {
983
const outboxLoad = vi.spyOn(threadOutboxManager, "load").mockResolvedValue(true);
984
onTestFinished(() => outboxLoad.mockRestore());
@@ -1296,29 +1210,6 @@ describe("mobile composer drafts", () => {
1210
expect(getComposerDraftSnapshot(key).attachments).toHaveLength(2);
1211
});
1212
1299
- it("cleans up an unreferenced image upload even when there is no local file URI", async () => {
1300
- const outboxLoad = vi.spyOn(threadOutboxManager, "load").mockResolvedValue(true);
1301
- onTestFinished(() => outboxLoad.mockRestore());
1302
- const environmentId = EnvironmentId.make("environment-1");
1303
- await releaseUnusedComposerAttachmentFiles([
1304
- {
1305
- id: "photo",
1306
- type: "image",
1307
- name: "photo.png",
1308
- mimeType: "image/png",
1309
- sizeBytes: 3,
1310
- dataUrl: "data:image/png;base64,YWJj",
1311
- previewUri: "file:///photo.png",
1312
- uploadedAttachmentId: "pending-photo",
1313
- uploadEnvironmentId: environmentId,
1314
- },
1315
- ]);
1316
- expect(composerAttachmentCleanupMocks.releaseUploads).toHaveBeenCalledWith(environmentId, [
1317
- "pending-photo",
1318
- ]);
1319
- expect(composerAttachmentCleanupMocks.remove).not.toHaveBeenCalled();
1320
- });
1321
-
1213
it.each(["file", "image"] as const)(
1214
"keeps signed-out %s attachments through cleanup and restart, and restores only the owning account",
1215
async (type) => {
@@ -1861,30 +1752,6 @@ describe("mobile composer drafts", () => {
1752
},
1753
});
1754
});
1864
- it("keeps legacy content-only drafts and rejects invalid selector state", () => {
1865
- expect(
1866
- decodePersistedComposerState({
1867
- schemaVersion: 1,
1868
- drafts: {
1869
- "environment-1:thread-1": DRAFT,
1870
- },
1871
- }).drafts,
1872
- ).toEqual({
1873
- "environment-1:thread-1": DRAFT,
1874
- });
1875
-
1876
- expect(() =>
1877
- decodePersistedComposerState({
1878
- schemaVersion: 1,
1879
- drafts: {
1880
- "environment-1:thread-1": {
1881
- ...DRAFT,
1882
- runtimeMode: "sometimes-safe",
1883
- },
1884
- },
1885
- }),
1886
- ).toThrow();
1887
- });
1755
1756
it("keeps share-import receipts on otherwise contentless new-task drafts", () => {
1757
const receiptDraft: ComposerDraft = {
@@ -1926,27 +1793,6 @@ describe("mobile composer drafts", () => {
1793
expect(kept[0]).toMatchObject(receiptDraft);
1794
});
1795
1929
- it("migrates archived signed-out new-task drafts the same way as live ones", () => {
1930
- const decoded = decodePersistedComposerState({
1931
- schemaVersion: 1,
1932
- drafts: {},
1933
- cloudAccountId: "account-1",
1934
- signedOutDrafts: {
1935
- "account-1": {
1936
- drafts: { "new-task:environment-1:project-1": { text: "archived", attachments: [] } },
1937
- queuedMessages: [],
1938
- },
1939
- },
1940
- });
1941
- const archived = Object.entries(decoded.cloudDrafts.signedOut["account-1"]?.drafts ?? {});
1942
- expect(archived).toHaveLength(1);
1943
- expect(archived[0]?.[0]).toMatch(/^new-task:[0-9a-z]+-[0-9a-z]+$/);
1944
- expect(archived[0]?.[1]).toMatchObject({
1945
- text: "archived",
1946
- project: { environmentId: "environment-1", projectId: "project-1" },
1947
- });
1948
- });
1949
-
1796
it("migrates project-keyed new-task drafts to id keys with the project stamped in", () => {
1797
const now = "2026-09-05T12:00:00.000Z";
1798
const [key, draft] = migrateLegacyNewTaskDraft(
apps/mobile/src/state/use-selected-thread-git-actions.test.ts
-31
@@ -153,37 +153,6 @@ describe("thread Git mutation permissions", () => {
153
},
154
);
155
156
- it.each(["create", "checkout", "commit on new branch"] as const)(
157
- "requires task permission before %s",
158
- async (operation) => {
159
- const actions = useSelectedThreadGitActions();
160
- if (operation === "create") {
161
- expect(await actions.onCreateSelectedThreadBranch("feature")).toBeNull();
162
- }
163
- if (operation === "checkout")
164
- expect(await actions.onCheckoutSelectedThreadBranch("feature")).toBeNull();
165
- if (operation === "commit on new branch")
166
- await actions.onRunSelectedThreadGitAction({ action: "commit", featureBranch: true });
167
- expect(state.branch).toBe("main");
168
- expect(state.thread.branch).toBe("main");
169
- expect(state.commits).toBe(0);
170
- },
171
- );
172
-
173
- it("rechecks task permission when a retained menu callback runs", async () => {
174
- state.scopes.add(AuthOrchestrationOperateScope);
175
- const actions = useSelectedThreadGitActions();
176
- state.scopes.delete(AuthOrchestrationOperateScope);
177
- expect(
178
- await actions.onCreateSelectedThreadWorktree({
179
- baseBranch: "main",
180
- newBranch: "feature/task",
181
- }),
182
- ).toBeNull();
183
- expect(state.worktrees).toEqual([]);
184
- expect(state.thread.worktreePath).toBeNull();
185
- });
186
-
156
it("keeps ordinary commits and pushes available without task permission", async () => {
157
const actions = useSelectedThreadGitActions();
158
await actions.onRunSelectedThreadGitAction({ action: "commit" });
apps/mobile/src/state/use-thread-outbox-drain.permissions.test.ts
-2
@@ -320,8 +320,6 @@ describe("queued task operation access", () => {
320
321
it.each([
322
{ isCreation: false, accepted: false },
323
- { isCreation: true, accepted: false },
324
- { isCreation: false, accepted: true },
323
{ isCreation: true, accepted: true },
324
])(
325
"preserves a rejected queue but removes an accepted turn after access loss (new task: $isCreation, accepted: $accepted)",
apps/mobile/src/state/use-thread-outbox-drain.test.ts
-52
@@ -1,7 +1,6 @@
1
import { acknowledgedThreadMessagesAtom } from "./acknowledged-thread-messages";
2
import {
3
CommandId,
4
- ComposerContextId,
4
EnvironmentId,
5
MessageId,
6
ProjectId,
@@ -277,32 +276,6 @@ describe("thread outbox attachment preparation", () => {
276
expect(remainingMessages()).toEqual([edited]);
277
});
278
280
- it("keeps an unchanged queued payload ready after attachment reuse", async () => {
281
- const message = withReusedFileUpload(
282
- queuedMessage({
283
- messageId: "message-reused-upload-current",
284
- text: "unchanged text",
285
- fileUri: "file:///documents/t3-composer-attachments/current.pdf",
286
- }),
287
- "pending-reused-upload",
288
- );
289
- harness.prepareTurnAttachments.mockResolvedValueOnce({
290
- status: "ready",
291
- attachments: [],
292
- draftAttachments: message.attachments,
293
- pendingAttachmentIds: ["pending-reused-upload"],
294
- });
295
- await harness.manager.enqueue(message);
296
- const revision = harness.manager.revisionOf(message.messageId);
297
- appAtomRegistry.set(editingQueuedMessageIdsAtom, { [message.messageId]: true });
298
-
299
- await expect(prepareQueuedMessageAttachments(message)).resolves.toMatchObject({
300
- status: "ready",
301
- persistedMessage: message,
302
- deliveryRevision: revision,
303
- });
304
- });
305
-
279
it("uses the known next revision after persisting uploaded references", async () => {
280
const message = queuedMessage({
281
messageId: "message-new-upload-revision",
@@ -616,31 +589,6 @@ describe("thread outbox delivered creation recovery", () => {
589
});
590
591
describe("thread outbox recovery rollback", () => {
619
- it("preserves inline context from setup edits when reopening a failed task", async () => {
620
- const message = queuedMessage({ messageId: "failed-context", text: "Original prompt" });
621
- const sourceKey = `${message.environmentId}:${message.threadId}`;
622
- const targetKey = "new-task:restored-failed-context";
623
- const record = {
624
- version: 1 as const,
625
- kind: "mention" as const,
626
- contextId: ComposerContextId.make("setup-file"),
627
- label: "Checkout.tsx",
628
- path: "src/Checkout.tsx",
629
- };
630
- const context = { version: 1 as const, records: [record] };
631
- const text = "[Checkout.tsx](t3-context://v1/mention/setup-file)";
632
- appAtomRegistry.set(composerDrafts.composerDraftsAtom, {
633
- [targetKey]: { text: message.text, attachments: [] },
634
- [sourceKey]: { text, context, attachments: [] },
635
- });
636
- await recoverFailedThreadDraft(message);
637
- expect(composerDrafts.getComposerDraftSnapshot(targetKey)).toMatchObject({
638
- text: `Original prompt\n\n${text}`,
639
- context,
640
- });
641
- expect(composerDrafts.getComposerDraftSnapshot(sourceKey).context).toBeUndefined();
642
- });
643
-
592
it("reopens a rejected task with setup edits and every attachment, even above the send cap", async () => {
593
const message = queuedMessage({ messageId: "failed-setup", text: "Original prompt" });
594
const sourceKey = `${message.environmentId}:${message.threadId}`;
apps/mobile/src/widgets/AgentActivity.test.ts
deleted
-74
@@ -1,74 +0,0 @@
1
-import { describe, expect, it, vi } from "vite-plus/test";
2
-
3
-vi.mock("@expo/ui/swift-ui", () => ({
4
- HStack: "HStack",
5
- Image: "Image",
6
- Spacer: "Spacer",
7
- Text: "Text",
8
- VStack: "VStack",
9
- ZStack: "ZStack",
10
-}));
11
-
12
-vi.mock("@expo/ui/swift-ui/modifiers", () => ({
13
- activityBackgroundTint: (value: unknown) => value,
14
- font: (value: unknown) => value,
15
- foregroundStyle: (value: unknown) => value,
16
- frame: (value: unknown) => value,
17
- layoutPriority: (value: unknown) => value,
18
- lineLimit: (value: unknown) => value,
19
- padding: (value: unknown) => value,
20
- resizable: (value: unknown) => value,
21
- widgetURL: (value: unknown) => ({ widgetURL: value }),
22
-}));
23
-
24
-vi.mock("expo-widgets", () => ({
25
- createLiveActivity: vi.fn((name: string, layout: unknown) => ({ layout, name })),
26
-}));
27
-
28
-import {
29
- AgentActivity,
30
- type AgentActivityProps,
31
- type AgentActivityRowProps,
32
-} from "./AgentActivity";
33
-
34
-function makeRow(overrides: Partial<AgentActivityRowProps>): AgentActivityRowProps {
35
- return {
36
- environmentId: "env-1",
37
- threadId: "thread-1",
38
- projectTitle: "Project",
39
- threadTitle: "Thread",
40
- modelTitle: "gpt-5.4",
41
- phase: "running",
42
- status: "Working",
43
- updatedAt: "2026-05-25T13:07:00.000Z",
44
- deepLink: "/threads/env-1/thread-1",
45
- ...overrides,
46
- };
47
-}
48
-
49
-const props = {
50
- title: "T3 Code",
51
- subtitle: "Agent work in progress",
52
- activeCount: 1,
53
- updatedAt: "2026-05-25T13:07:00.000Z",
54
- activities: [],
55
-} satisfies AgentActivityProps;
56
-
57
-const environment = {
58
- colorScheme: "dark",
59
- isLuminanceReduced: false,
60
-} as const;
61
-
62
-describe("AgentActivity widget layout", () => {
63
- it("omits the deep link for unsafe paths and empty aggregates", () => {
64
- expect(JSON.stringify(AgentActivity(props, environment as never))).not.toContain("widgetURL");
65
- expect(
66
- JSON.stringify(
67
- AgentActivity(
68
- { ...props, activities: [makeRow({ deepLink: "//evil.example" })] },
69
- environment as never,
70
- ),
71
- ),
72
- ).not.toContain("widgetURL");
73
- });
74
-});
apps/mobile/src/widgets/subscriptionUsageSnapshot.test.ts
-34
@@ -10,7 +10,6 @@ import {
10
buildSubscriptionUsageSnapshot,
11
createWidgetRefresher,
12
WIDGET_REFRESH_INTERVAL,
13
- subscriptionUsageTimeline,
13
} from "./subscriptionUsageSnapshot";
14
15
const checkedAt = "2026-09-05T12:00:00.000Z";
@@ -101,29 +100,6 @@ describe("subscription widget snapshots", () => {
100
expect(snapshot.providers[0]?.name).toBe("Codex");
101
expect(JSON.stringify(snapshot)).not.toContain("example.com");
102
});
104
- it("keeps unavailable quotas distinct from zero usage and omits provider error messages", () => {
105
- const snapshot = buildSubscriptionUsageSnapshot(
106
- presentations([
107
- provider({
108
- usageLimits: {
109
- ...limits,
110
- unavailable: { reason: "probeFailed", message: "token secret" },
111
- },
112
- }),
113
- ]),
114
- deepLink,
115
- );
116
- expect(snapshot.providers[0]?.windows).toEqual([]);
117
- expect(JSON.stringify(snapshot)).not.toContain("token secret");
118
- expect(
119
- buildSubscriptionUsageSnapshot(
120
- presentations([
121
- provider({ usageLimits: { checkedAt, windows: [{ ...window, usedPercent: 0 }] } }),
122
- ]),
123
- deepLink,
124
- ).providers[0]?.windows[0]?.remaining,
125
- ).toBe(100);
126
- });
103
it("bounds OS storage and puts the most constrained windows first", () => {
104
const windows = Array.from({ length: 20 }, (_, index) => ({
105
...window,
@@ -138,16 +114,6 @@ describe("subscription widget snapshots", () => {
114
expect(snapshot.providers[0]?.totalWindows).toBe(20);
115
expect(snapshot.providers[0]?.windows[0]?.remaining).toBe(5);
116
});
141
- it("marks a malformed check time immediately stale without storing null", () => {
142
- const snapshot = buildSubscriptionUsageSnapshot(
143
- presentations([provider({ usageLimits: { ...limits, checkedAt: "invalid" } })]),
144
- deepLink,
145
- );
146
- expect(snapshot.checkedAt).toBe(0);
147
- expect(snapshot.providers[0]).toMatchObject({ expiresAt: 0, windows: [] });
148
- expect(subscriptionUsageTimeline(snapshot, now)).toHaveLength(1);
149
- expect(JSON.stringify(snapshot)).not.toContain("null");
150
- });
117
it("uses the freshest copy of an account across environments before pooling", () => {
118
const input = presentations();
119
input.set(EnvironmentId.make("other"), {