Skip to content

Commit 3583cd2

Browse files
authored
test: favor behavior over implementation details (#7157)
1 parent 2773229 commit 3583cd2

9 files changed

Lines changed: 9 additions & 87 deletions

apps/mobile/src/features/terminal/terminalLaunchContext.test.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { describe, expect, it } from "vite-plus/test";
22
import { EnvironmentId, ThreadId } from "@t3tools/contracts";
33

44
import {
5-
peekPendingTerminalLaunch,
65
resolvePreferredThreadWorktreePath,
76
resolveTerminalOpenLocation,
87
stagePendingTerminalLaunch,
@@ -82,19 +81,13 @@ describe("pending terminal launches", () => {
8281
},
8382
});
8483

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-
});
9184
expect(takePendingTerminalLaunch(target)).toEqual({
9285
cwd: "/repo/worktrees/feature",
9386
worktreePath: "/repo/worktrees/feature",
9487
env: { FOO: "bar" },
9588
initialInput: "pnpm dev\r",
9689
});
97-
expect(peekPendingTerminalLaunch(target)).toBeNull();
90+
expect(takePendingTerminalLaunch(target)).toBeNull();
9891
});
9992

10093
it("keeps pending launches isolated per terminal target", () => {
@@ -118,7 +111,6 @@ describe("pending terminal launches", () => {
118111
},
119112
});
120113

121-
expect(peekPendingTerminalLaunch(otherTarget)).toBeNull();
122114
expect(takePendingTerminalLaunch(otherTarget)).toBeNull();
123115
expect(takePendingTerminalLaunch(primaryTarget)).toEqual({
124116
cwd: "/repo/root",

apps/mobile/src/features/terminal/terminalLaunchContext.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,6 @@ export function stagePendingTerminalLaunch(input: {
3636
});
3737
}
3838

39-
export function peekPendingTerminalLaunch(
40-
target: PendingTerminalLaunchTarget,
41-
): PendingTerminalLaunch | null {
42-
return pendingTerminalLaunches.get(pendingTerminalLaunchKey(target)) ?? null;
43-
}
44-
4539
export function takePendingTerminalLaunch(
4640
target: PendingTerminalLaunchTarget,
4741
): PendingTerminalLaunch | null {

apps/mobile/src/features/terminal/threadTerminalPanelModel.test.ts

Lines changed: 0 additions & 40 deletions
This file was deleted.

apps/mobile/src/features/terminal/threadTerminalPanelModel.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,6 @@ export interface TerminalGridSize {
1313
readonly rows: number;
1414
}
1515

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-
2816
export function buildThreadTerminalAttachInput(
2917
identity: ThreadTerminalSubscriptionIdentity,
3018
gridSize: TerminalGridSize,

apps/web/src/components/chat/MessagesTimeline.test.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ function matchMedia() {
134134
}
135135

136136
let MessagesTimeline: typeof import("./MessagesTimeline").MessagesTimeline;
137-
let toolCallExpandedBodyClassName: typeof import("./MessagesTimeline").toolCallExpandedBodyClassName;
138137

139138
beforeAll(async () => {
140139
const classList = {
@@ -168,7 +167,7 @@ beforeAll(async () => {
168167
},
169168
});
170169

171-
({ MessagesTimeline, toolCallExpandedBodyClassName } = await import("./MessagesTimeline"));
170+
({ MessagesTimeline } = await import("./MessagesTimeline"));
172171
}, 30_000);
173172

174173
const ACTIVE_THREAD_ENVIRONMENT_ID = EnvironmentId.make("environment-local");
@@ -238,11 +237,6 @@ function buildAssistantTimelineEntry(text: string) {
238237
}
239238

240239
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-
246240
it("uses the larger leading inset only when the top fade is enabled", () => {
247241
const timelineEntries = [buildUserTimelineEntry("Hello")];
248242

apps/web/src/components/chat/MessagesTimeline.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2063,7 +2063,7 @@ function buildToolCallExpandedBody(
20632063
return blocks.length > 0 ? blocks.join("\n\n") : null;
20642064
}
20652065

2066-
export const toolCallExpandedBodyClassName =
2066+
const toolCallExpandedBodyClassName =
20672067
"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";
20682068

20692069
function workEntryIconName(workEntry: TimelineWorkEntry): WorkEntryIconName {

apps/web/src/components/composerFooterLayout.test.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { describe, expect, it } from "vite-plus/test";
33
import {
44
COMPOSER_FOOTER_COMPACT_BREAKPOINT_PX,
55
COMPOSER_FOOTER_WIDE_ACTIONS_COMPACT_BREAKPOINT_PX,
6-
COMPOSER_PRIMARY_ACTIONS_COMPACT_BREAKPOINT_PX,
76
shouldUseCompactComposerPrimaryActions,
87
shouldUseCompactComposerFooter,
98
} from "./composerFooterLayout";
@@ -38,16 +37,14 @@ describe("shouldUseCompactComposerFooter", () => {
3837

3938
describe("shouldUseCompactComposerPrimaryActions", () => {
4039
it("matches the wide footer breakpoint", () => {
41-
expect(COMPOSER_PRIMARY_ACTIONS_COMPACT_BREAKPOINT_PX).toBe(
42-
COMPOSER_FOOTER_WIDE_ACTIONS_COMPACT_BREAKPOINT_PX,
43-
);
4440
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+
),
4845
).toBe(true);
4946
expect(
50-
shouldUseCompactComposerPrimaryActions(COMPOSER_PRIMARY_ACTIONS_COMPACT_BREAKPOINT_PX, {
47+
shouldUseCompactComposerPrimaryActions(COMPOSER_FOOTER_WIDE_ACTIONS_COMPACT_BREAKPOINT_PX, {
5148
hasWideActions: true,
5249
}),
5350
).toBe(false);

apps/web/src/components/composerFooterLayout.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
export const COMPOSER_FOOTER_COMPACT_BREAKPOINT_PX = 620;
22
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;
53

64
export function shouldUseCompactComposerFooter(
75
width: number | null,
@@ -20,5 +18,5 @@ export function shouldUseCompactComposerPrimaryActions(
2018
if (!options?.hasWideActions) {
2119
return false;
2220
}
23-
return width !== null && width < COMPOSER_PRIMARY_ACTIONS_COMPACT_BREAKPOINT_PX;
21+
return width !== null && width < COMPOSER_FOOTER_WIDE_ACTIONS_COMPACT_BREAKPOINT_PX;
2422
}

packages/shared/src/terminalLabels.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ describe("resolveTerminalSessionLabel", () => {
3434
describe("nextTerminalId", () => {
3535
it("allocates term-1 when no terminals are listed yet", () => {
3636
expect(nextTerminalId([])).toBe(DEFAULT_TERMINAL_ID);
37-
expect(nextTerminalId([])).toBe("term-1");
3837
});
3938

4039
it("allocates term-2 when only term-1 exists", () => {

0 commit comments

Comments
 (0)