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 24, 15:15 UTC
test: favor behavior over implementation details (#7157)
t3-code[bot] committed
Aug 16, 2026 at 10:06 UTC
3583cd27dccda1b35fe80d9411a95a7217cc8176
9 files changed
+9
-87
apps/mobile/src/features/terminal/terminalLaunchContext.test.ts
+1
-9
@@ -2,7 +2,6 @@ import { describe, expect, it } from "vite-plus/test";
2
import { EnvironmentId, ThreadId } from "@t3tools/contracts";
3
4
import {
5
- peekPendingTerminalLaunch,
5
resolvePreferredThreadWorktreePath,
6
resolveTerminalOpenLocation,
7
stagePendingTerminalLaunch,
@@ -82,19 +81,13 @@ describe("pending terminal launches", () => {
81
},
82
});
83
85
- expect(peekPendingTerminalLaunch(target)).toEqual({
86
- cwd: "/repo/worktrees/feature",
87
- worktreePath: "/repo/worktrees/feature",
88
- env: { FOO: "bar" },
89
- initialInput: "pnpm dev\r",
90
- });
84
expect(takePendingTerminalLaunch(target)).toEqual({
85
cwd: "/repo/worktrees/feature",
86
worktreePath: "/repo/worktrees/feature",
87
env: { FOO: "bar" },
88
initialInput: "pnpm dev\r",
89
});
97
- expect(peekPendingTerminalLaunch(target)).toBeNull();
90
+ expect(takePendingTerminalLaunch(target)).toBeNull();
91
});
92
93
it("keeps pending launches isolated per terminal target", () => {
@@ -118,7 +111,6 @@ describe("pending terminal launches", () => {
111
},
112
});
113
121
- expect(peekPendingTerminalLaunch(otherTarget)).toBeNull();
114
expect(takePendingTerminalLaunch(otherTarget)).toBeNull();
115
expect(takePendingTerminalLaunch(primaryTarget)).toEqual({
116
cwd: "/repo/root",
apps/mobile/src/features/terminal/terminalLaunchContext.ts
-6
@@ -36,12 +36,6 @@ export function stagePendingTerminalLaunch(input: {
36
});
37
}
38
39
-export function peekPendingTerminalLaunch(
40
- target: PendingTerminalLaunchTarget,
41
-): PendingTerminalLaunch | null {
42
- return pendingTerminalLaunches.get(pendingTerminalLaunchKey(target)) ?? null;
43
-}
44
-
39
export function takePendingTerminalLaunch(
40
target: PendingTerminalLaunchTarget,
41
): PendingTerminalLaunch | null {
apps/mobile/src/features/terminal/threadTerminalPanelModel.test.ts
deleted
-40
@@ -1,40 +0,0 @@
1
-import { EnvironmentId, ThreadId } from "@t3tools/contracts";
2
-import { describe, expect, it } from "vite-plus/test";
3
-
4
-import {
5
- buildThreadTerminalAttachInput,
6
- threadTerminalSubscriptionKey,
7
- type ThreadTerminalSubscriptionIdentity,
8
-} from "./threadTerminalPanelModel";
9
-
10
-const identity: ThreadTerminalSubscriptionIdentity = {
11
- environmentId: EnvironmentId.make("env-1"),
12
- threadId: ThreadId.make("thread-1"),
13
- terminalId: "default",
14
- cwd: "/repo",
15
- worktreePath: "/repo",
16
-};
17
-
18
-describe("threadTerminalSubscriptionKey", () => {
19
- it("does not include mutable terminal dimensions", () => {
20
- const initialAttach = buildThreadTerminalAttachInput(identity, { cols: 80, rows: 24 });
21
- const resizedAttach = buildThreadTerminalAttachInput(identity, { cols: 132, rows: 40 });
22
-
23
- expect(initialAttach).not.toEqual(resizedAttach);
24
- expect(threadTerminalSubscriptionKey({ ...identity, ...initialAttach })).toBe(
25
- threadTerminalSubscriptionKey({ ...identity, ...resizedAttach }),
26
- );
27
- });
28
-
29
- it.each([
30
- ["environment", { environmentId: EnvironmentId.make("env-2") }],
31
- ["thread", { threadId: ThreadId.make("thread-2") }],
32
- ["terminal", { terminalId: "term-2" }],
33
- ["cwd", { cwd: "/repo/packages/app" }],
34
- ["worktree", { worktreePath: "/repo/worktrees/feature" }],
35
- ])("changes when the %s identity changes", (_label, update) => {
36
- expect(threadTerminalSubscriptionKey({ ...identity, ...update })).not.toBe(
37
- threadTerminalSubscriptionKey(identity),
38
- );
39
- });
40
-});
apps/mobile/src/features/terminal/threadTerminalPanelModel.ts
-12
@@ -13,18 +13,6 @@ export interface TerminalGridSize {
13
readonly rows: number;
14
}
15
16
-export function threadTerminalSubscriptionKey(
17
- identity: ThreadTerminalSubscriptionIdentity,
18
-): string {
19
- return JSON.stringify([
20
- identity.environmentId,
21
- identity.threadId,
22
- identity.terminalId,
23
- identity.cwd,
24
- identity.worktreePath,
25
- ]);
26
-}
27
-
16
export function buildThreadTerminalAttachInput(
17
identity: ThreadTerminalSubscriptionIdentity,
18
gridSize: TerminalGridSize,
apps/web/src/components/chat/MessagesTimeline.test.tsx
+1
-7
@@ -134,7 +134,6 @@ function matchMedia() {
134
}
135
136
let MessagesTimeline: typeof import("./MessagesTimeline").MessagesTimeline;
137
-let toolCallExpandedBodyClassName: typeof import("./MessagesTimeline").toolCallExpandedBodyClassName;
137
138
beforeAll(async () => {
139
const classList = {
@@ -168,7 +167,7 @@ beforeAll(async () => {
167
},
168
});
169
171
- ({ MessagesTimeline, toolCallExpandedBodyClassName } = await import("./MessagesTimeline"));
170
+ ({ MessagesTimeline } = await import("./MessagesTimeline"));
171
}, 30_000);
172
173
const ACTIVE_THREAD_ENVIRONMENT_ID = EnvironmentId.make("environment-local");
@@ -238,11 +237,6 @@ function buildAssistantTimelineEntry(text: string) {
237
}
238
239
describe("MessagesTimeline", () => {
241
- it("sizes expanded tool details with the configured code font size", () => {
242
- expect(toolCallExpandedBodyClassName).toContain("var(--font-size-code");
243
- expect(toolCallExpandedBodyClassName).not.toContain("text-[11px]");
244
- });
245
-
240
it("uses the larger leading inset only when the top fade is enabled", () => {
241
const timelineEntries = [buildUserTimelineEntry("Hello")];
242
apps/web/src/components/chat/MessagesTimeline.tsx
+1
-1
@@ -2063,7 +2063,7 @@ function buildToolCallExpandedBody(
2063
return blocks.length > 0 ? blocks.join("\n\n") : null;
2064
}
2065
2066
-export const toolCallExpandedBodyClassName =
2066
+const toolCallExpandedBodyClassName =
2067
"max-h-64 cursor-text overflow-auto whitespace-pre-wrap break-words font-mono text-secondary-label text-[length:var(--font-size-code,0.6875rem)] leading-relaxed select-text";
2068
2069
function workEntryIconName(workEntry: TimelineWorkEntry): WorkEntryIconName {
apps/web/src/components/composerFooterLayout.test.ts
+5
-8
@@ -3,7 +3,6 @@ import { describe, expect, it } from "vite-plus/test";
3
import {
4
COMPOSER_FOOTER_COMPACT_BREAKPOINT_PX,
5
COMPOSER_FOOTER_WIDE_ACTIONS_COMPACT_BREAKPOINT_PX,
6
- COMPOSER_PRIMARY_ACTIONS_COMPACT_BREAKPOINT_PX,
6
shouldUseCompactComposerPrimaryActions,
7
shouldUseCompactComposerFooter,
8
} from "./composerFooterLayout";
@@ -38,16 +37,14 @@ describe("shouldUseCompactComposerFooter", () => {
37
38
describe("shouldUseCompactComposerPrimaryActions", () => {
39
it("matches the wide footer breakpoint", () => {
41
- expect(COMPOSER_PRIMARY_ACTIONS_COMPACT_BREAKPOINT_PX).toBe(
42
- COMPOSER_FOOTER_WIDE_ACTIONS_COMPACT_BREAKPOINT_PX,
43
- );
40
expect(
45
- shouldUseCompactComposerPrimaryActions(COMPOSER_PRIMARY_ACTIONS_COMPACT_BREAKPOINT_PX - 1, {
46
- hasWideActions: true,
47
- }),
41
+ shouldUseCompactComposerPrimaryActions(
42
+ COMPOSER_FOOTER_WIDE_ACTIONS_COMPACT_BREAKPOINT_PX - 1,
43
+ { hasWideActions: true },
44
+ ),
45
).toBe(true);
46
expect(
50
- shouldUseCompactComposerPrimaryActions(COMPOSER_PRIMARY_ACTIONS_COMPACT_BREAKPOINT_PX, {
47
+ shouldUseCompactComposerPrimaryActions(COMPOSER_FOOTER_WIDE_ACTIONS_COMPACT_BREAKPOINT_PX, {
48
hasWideActions: true,
49
}),
50
).toBe(false);
apps/web/src/components/composerFooterLayout.ts
+1
-3
@@ -1,7 +1,5 @@
1
export const COMPOSER_FOOTER_COMPACT_BREAKPOINT_PX = 620;
2
export const COMPOSER_FOOTER_WIDE_ACTIONS_COMPACT_BREAKPOINT_PX = 780;
3
-export const COMPOSER_PRIMARY_ACTIONS_COMPACT_BREAKPOINT_PX =
4
- COMPOSER_FOOTER_WIDE_ACTIONS_COMPACT_BREAKPOINT_PX;
3
4
export function shouldUseCompactComposerFooter(
5
width: number | null,
@@ -20,5 +18,5 @@ export function shouldUseCompactComposerPrimaryActions(
18
if (!options?.hasWideActions) {
19
return false;
20
}
23
- return width !== null && width < COMPOSER_PRIMARY_ACTIONS_COMPACT_BREAKPOINT_PX;
21
+ return width !== null && width < COMPOSER_FOOTER_WIDE_ACTIONS_COMPACT_BREAKPOINT_PX;
22
}
packages/shared/src/terminalLabels.test.ts
-1
@@ -34,7 +34,6 @@ describe("resolveTerminalSessionLabel", () => {
34
describe("nextTerminalId", () => {
35
it("allocates term-1 when no terminals are listed yet", () => {
36
expect(nextTerminalId([])).toBe(DEFAULT_TERMINAL_ID);
37
- expect(nextTerminalId([])).toBe("term-1");
37
});
38
39
it("allocates term-2 when only term-1 exists", () => {