Skip to content

Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.

test: favor behavior over implementation details (#7157)

t3-code[bot]3583cd27dccd
diff --git a/apps/mobile/src/features/terminal/terminalLaunchContext.test.ts b/apps/mobile/src/features/terminal/terminalLaunchContext.test.ts
index cbd446a88..470acffa3 100644
--- a/apps/mobile/src/features/terminal/terminalLaunchContext.test.ts
+++ b/apps/mobile/src/features/terminal/terminalLaunchContext.test.ts
@@ -2,7 +2,6 @@ import { describe, expect, it } from "vite-plus/test";
import { EnvironmentId, ThreadId } from "@t3tools/contracts";
import {
- peekPendingTerminalLaunch,
resolvePreferredThreadWorktreePath,
resolveTerminalOpenLocation,
stagePendingTerminalLaunch,
@@ -82,19 +81,13 @@ describe("pending terminal launches", () => {
},
});
- expect(peekPendingTerminalLaunch(target)).toEqual({
- cwd: "/repo/worktrees/feature",
- worktreePath: "/repo/worktrees/feature",
- env: { FOO: "bar" },
- initialInput: "pnpm dev\r",
- });
expect(takePendingTerminalLaunch(target)).toEqual({
cwd: "/repo/worktrees/feature",
worktreePath: "/repo/worktrees/feature",
env: { FOO: "bar" },
initialInput: "pnpm dev\r",
});
- expect(peekPendingTerminalLaunch(target)).toBeNull();
+ expect(takePendingTerminalLaunch(target)).toBeNull();
});
it("keeps pending launches isolated per terminal target", () => {
@@ -118,7 +111,6 @@ describe("pending terminal launches", () => {
},
});
- expect(peekPendingTerminalLaunch(otherTarget)).toBeNull();
expect(takePendingTerminalLaunch(otherTarget)).toBeNull();
expect(takePendingTerminalLaunch(primaryTarget)).toEqual({
cwd: "/repo/root",
diff --git a/apps/mobile/src/features/terminal/terminalLaunchContext.ts b/apps/mobile/src/features/terminal/terminalLaunchContext.ts
index c1a774920..af67497a3 100644
--- a/apps/mobile/src/features/terminal/terminalLaunchContext.ts
+++ b/apps/mobile/src/features/terminal/terminalLaunchContext.ts
@@ -36,12 +36,6 @@ export function stagePendingTerminalLaunch(input: {
});
}
-export function peekPendingTerminalLaunch(
- target: PendingTerminalLaunchTarget,
-): PendingTerminalLaunch | null {
- return pendingTerminalLaunches.get(pendingTerminalLaunchKey(target)) ?? null;
-}
-
export function takePendingTerminalLaunch(
target: PendingTerminalLaunchTarget,
): PendingTerminalLaunch | null {
diff --git a/apps/mobile/src/features/terminal/threadTerminalPanelModel.test.ts b/apps/mobile/src/features/terminal/threadTerminalPanelModel.test.ts
deleted file mode 100644
index 871a28d85..000000000
--- a/apps/mobile/src/features/terminal/threadTerminalPanelModel.test.ts
+++ /dev/null
@@ -1,40 +0,0 @@
-import { EnvironmentId, ThreadId } from "@t3tools/contracts";
-import { describe, expect, it } from "vite-plus/test";
-
-import {
- buildThreadTerminalAttachInput,
- threadTerminalSubscriptionKey,
- type ThreadTerminalSubscriptionIdentity,
-} from "./threadTerminalPanelModel";
-
-const identity: ThreadTerminalSubscriptionIdentity = {
- environmentId: EnvironmentId.make("env-1"),
- threadId: ThreadId.make("thread-1"),
- terminalId: "default",
- cwd: "/repo",
- worktreePath: "/repo",
-};
-
-describe("threadTerminalSubscriptionKey", () => {
- it("does not include mutable terminal dimensions", () => {
- const initialAttach = buildThreadTerminalAttachInput(identity, { cols: 80, rows: 24 });
- const resizedAttach = buildThreadTerminalAttachInput(identity, { cols: 132, rows: 40 });
-
- expect(initialAttach).not.toEqual(resizedAttach);
- expect(threadTerminalSubscriptionKey({ ...identity, ...initialAttach })).toBe(
- threadTerminalSubscriptionKey({ ...identity, ...resizedAttach }),
- );
- });
-
- it.each([
- ["environment", { environmentId: EnvironmentId.make("env-2") }],
- ["thread", { threadId: ThreadId.make("thread-2") }],
- ["terminal", { terminalId: "term-2" }],
- ["cwd", { cwd: "/repo/packages/app" }],
- ["worktree", { worktreePath: "/repo/worktrees/feature" }],
- ])("changes when the %s identity changes", (_label, update) => {
- expect(threadTerminalSubscriptionKey({ ...identity, ...update })).not.toBe(
- threadTerminalSubscriptionKey(identity),
- );
- });
-});
diff --git a/apps/mobile/src/features/terminal/threadTerminalPanelModel.ts b/apps/mobile/src/features/terminal/threadTerminalPanelModel.ts
index 9f1d032d2..07ef46a7b 100644
--- a/apps/mobile/src/features/terminal/threadTerminalPanelModel.ts
+++ b/apps/mobile/src/features/terminal/threadTerminalPanelModel.ts
@@ -13,18 +13,6 @@ export interface TerminalGridSize {
readonly rows: number;
}
-export function threadTerminalSubscriptionKey(
- identity: ThreadTerminalSubscriptionIdentity,
-): string {
- return JSON.stringify([
- identity.environmentId,
- identity.threadId,
- identity.terminalId,
- identity.cwd,
- identity.worktreePath,
- ]);
-}
-
export function buildThreadTerminalAttachInput(
identity: ThreadTerminalSubscriptionIdentity,
gridSize: TerminalGridSize,
diff --git a/apps/web/src/components/chat/MessagesTimeline.test.tsx b/apps/web/src/components/chat/MessagesTimeline.test.tsx
index e51095bb0..617ee0b80 100644
--- a/apps/web/src/components/chat/MessagesTimeline.test.tsx
+++ b/apps/web/src/components/chat/MessagesTimeline.test.tsx
@@ -134,7 +134,6 @@ function matchMedia() {
}
let MessagesTimeline: typeof import("./MessagesTimeline").MessagesTimeline;
-let toolCallExpandedBodyClassName: typeof import("./MessagesTimeline").toolCallExpandedBodyClassName;
beforeAll(async () => {
const classList = {
@@ -168,7 +167,7 @@ beforeAll(async () => {
},
});
- ({ MessagesTimeline, toolCallExpandedBodyClassName } = await import("./MessagesTimeline"));
+ ({ MessagesTimeline } = await import("./MessagesTimeline"));
}, 30_000);
const ACTIVE_THREAD_ENVIRONMENT_ID = EnvironmentId.make("environment-local");
@@ -238,11 +237,6 @@ function buildAssistantTimelineEntry(text: string) {
}
describe("MessagesTimeline", () => {
- it("sizes expanded tool details with the configured code font size", () => {
- expect(toolCallExpandedBodyClassName).toContain("var(--font-size-code");
- expect(toolCallExpandedBodyClassName).not.toContain("text-[11px]");
- });
-
it("uses the larger leading inset only when the top fade is enabled", () => {
const timelineEntries = [buildUserTimelineEntry("Hello")];
diff --git a/apps/web/src/components/chat/MessagesTimeline.tsx b/apps/web/src/components/chat/MessagesTimeline.tsx
index b1b665ab7..c90aa771f 100644
--- a/apps/web/src/components/chat/MessagesTimeline.tsx
+++ b/apps/web/src/components/chat/MessagesTimeline.tsx
@@ -2063,7 +2063,7 @@ function buildToolCallExpandedBody(
return blocks.length > 0 ? blocks.join("\n\n") : null;
}
-export const toolCallExpandedBodyClassName =
+const toolCallExpandedBodyClassName =
"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";
function workEntryIconName(workEntry: TimelineWorkEntry): WorkEntryIconName {
diff --git a/apps/web/src/components/composerFooterLayout.test.ts b/apps/web/src/components/composerFooterLayout.test.ts
index b9f2a6b6a..92e054df5 100644
--- a/apps/web/src/components/composerFooterLayout.test.ts
+++ b/apps/web/src/components/composerFooterLayout.test.ts
@@ -3,7 +3,6 @@ import { describe, expect, it } from "vite-plus/test";
import {
COMPOSER_FOOTER_COMPACT_BREAKPOINT_PX,
COMPOSER_FOOTER_WIDE_ACTIONS_COMPACT_BREAKPOINT_PX,
- COMPOSER_PRIMARY_ACTIONS_COMPACT_BREAKPOINT_PX,
shouldUseCompactComposerPrimaryActions,
shouldUseCompactComposerFooter,
} from "./composerFooterLayout";
@@ -38,16 +37,14 @@ describe("shouldUseCompactComposerFooter", () => {
describe("shouldUseCompactComposerPrimaryActions", () => {
it("matches the wide footer breakpoint", () => {
- expect(COMPOSER_PRIMARY_ACTIONS_COMPACT_BREAKPOINT_PX).toBe(
- COMPOSER_FOOTER_WIDE_ACTIONS_COMPACT_BREAKPOINT_PX,
- );
expect(
- shouldUseCompactComposerPrimaryActions(COMPOSER_PRIMARY_ACTIONS_COMPACT_BREAKPOINT_PX - 1, {
- hasWideActions: true,
- }),
+ shouldUseCompactComposerPrimaryActions(
+ COMPOSER_FOOTER_WIDE_ACTIONS_COMPACT_BREAKPOINT_PX - 1,
+ { hasWideActions: true },
+ ),
).toBe(true);
expect(
- shouldUseCompactComposerPrimaryActions(COMPOSER_PRIMARY_ACTIONS_COMPACT_BREAKPOINT_PX, {
+ shouldUseCompactComposerPrimaryActions(COMPOSER_FOOTER_WIDE_ACTIONS_COMPACT_BREAKPOINT_PX, {
hasWideActions: true,
}),
).toBe(false);
diff --git a/apps/web/src/components/composerFooterLayout.ts b/apps/web/src/components/composerFooterLayout.ts
index ae5fd5666..5e0b3a8ea 100644
--- a/apps/web/src/components/composerFooterLayout.ts
+++ b/apps/web/src/components/composerFooterLayout.ts
@@ -1,7 +1,5 @@
export const COMPOSER_FOOTER_COMPACT_BREAKPOINT_PX = 620;
export const COMPOSER_FOOTER_WIDE_ACTIONS_COMPACT_BREAKPOINT_PX = 780;
-export const COMPOSER_PRIMARY_ACTIONS_COMPACT_BREAKPOINT_PX =
- COMPOSER_FOOTER_WIDE_ACTIONS_COMPACT_BREAKPOINT_PX;
export function shouldUseCompactComposerFooter(
width: number | null,
@@ -20,5 +18,5 @@ export function shouldUseCompactComposerPrimaryActions(
if (!options?.hasWideActions) {
return false;
}
- return width !== null && width < COMPOSER_PRIMARY_ACTIONS_COMPACT_BREAKPOINT_PX;
+ return width !== null && width < COMPOSER_FOOTER_WIDE_ACTIONS_COMPACT_BREAKPOINT_PX;
}
diff --git a/packages/shared/src/terminalLabels.test.ts b/packages/shared/src/terminalLabels.test.ts
index 4621f3af8..b8a146b0c 100644
--- a/packages/shared/src/terminalLabels.test.ts
+++ b/packages/shared/src/terminalLabels.test.ts
@@ -34,7 +34,6 @@ describe("resolveTerminalSessionLabel", () => {
describe("nextTerminalId", () => {
it("allocates term-1 when no terminals are listed yet", () => {
expect(nextTerminalId([])).toBe(DEFAULT_TERMINAL_ID);
- expect(nextTerminalId([])).toBe("term-1");
});
it("allocates term-2 when only term-1 exists", () => {