Skip to content
TypeScript

test(web): remove tests for unreachable helpers (#8738)

t3-code[bot]2daff8c25adf
diff --git a/apps/web/src/appearanceFonts.test.ts b/apps/web/src/appearanceFonts.test.ts
index 31a2f1d779c..0e3ebb20834 100644
--- a/apps/web/src/appearanceFonts.test.ts
+++ b/apps/web/src/appearanceFonts.test.ts
@@ -5,9 +5,6 @@ import {
clampCodeFontSize,
clampInterfaceFontSize,
clampPromptFontSize,
- DEFAULT_CODE_FONT_STACK,
- DEFAULT_SANS_FONT_STACK,
- appearanceFontStack,
cssFontFamilies,
resolveDefaultFamilyLabel,
resolveTerminalFontPreference,
@@ -58,18 +55,6 @@ describe("resolveDefaultFamilyLabel", () => {
});
});
-describe("appearanceFontStack", () => {
- it("prepends the custom family to the default stack", () => {
- expect(appearanceFontStack("Fira Code", DEFAULT_CODE_FONT_STACK)).toBe(
- `"Fira Code", ${DEFAULT_CODE_FONT_STACK}`,
- );
- });
-
- it("falls back to the default stack when unset", () => {
- expect(appearanceFontStack("", DEFAULT_SANS_FONT_STACK)).toBe(DEFAULT_SANS_FONT_STACK);
- });
-});
-
describe("resolveTerminalFontPreference", () => {
it("inherits the code font in simple mode", () => {
expect(
diff --git a/apps/web/src/appearanceFonts.ts b/apps/web/src/appearanceFonts.ts
index 6053e5fb0dd..74bb88a06c3 100644
--- a/apps/web/src/appearanceFonts.ts
+++ b/apps/web/src/appearanceFonts.ts
@@ -71,12 +71,6 @@ export function cssFontFamilies(input: string): string | null {
return families.length > 0 ? families.join(", ") : null;
}
-/** The full stack a preference resolves to: custom families before the default. */
-export function appearanceFontStack(custom: string, defaultStack: string): string {
- const families = cssFontFamilies(custom);
- return families === null ? defaultStack : `${families}, ${defaultStack}`;
-}
-
export interface AppearanceFontPreferences {
readonly sans: string;
readonly code: string;
diff --git a/apps/web/src/components/Sidebar.logic.test.ts b/apps/web/src/components/Sidebar.logic.test.ts
index 9d1eb6bcd19..dbf8fcf7853 100644
--- a/apps/web/src/components/Sidebar.logic.test.ts
+++ b/apps/web/src/components/Sidebar.logic.test.ts
@@ -20,7 +20,6 @@ import {
isTrailingDoubleClick,
orderItemsByPreferredIds,
resolveProjectStatusIndicator,
- resolveSidebarStageBadgeLabel,
resolveThreadRowClassName,
resolveSidebarThreadStatus,
resolveThreadStatusPill,
@@ -236,44 +235,6 @@ describe("buildMultiSelectThreadContextMenuItems", () => {
});
});
-describe("resolveSidebarStageBadgeLabel", () => {
- it("returns Nightly for nightly primary server versions", () => {
- expect(
- resolveSidebarStageBadgeLabel({
- primaryServerVersion: "0.0.28-nightly.20260616.12",
- fallbackStageLabel: "Alpha",
- }),
- ).toBe("Nightly");
- });
-
- it("returns the fallback label for stable primary server versions", () => {
- expect(
- resolveSidebarStageBadgeLabel({
- primaryServerVersion: "0.0.27",
- fallbackStageLabel: "Alpha",
- }),
- ).toBe("Alpha");
- });
-
- it("returns the fallback label when the primary server version is missing", () => {
- expect(
- resolveSidebarStageBadgeLabel({
- primaryServerVersion: null,
- fallbackStageLabel: "Dev",
- }),
- ).toBe("Dev");
- });
-
- it("returns the fallback label for malformed nightly prerelease versions", () => {
- expect(
- resolveSidebarStageBadgeLabel({
- primaryServerVersion: "0.0.28-nightly.20260616",
- fallbackStageLabel: "Alpha",
- }),
- ).toBe("Alpha");
- });
-});
-
function makeLatestTurn(overrides?: {
completedAt?: string | null;
startedAt?: string | null;
diff --git a/apps/web/src/components/Sidebar.logic.ts b/apps/web/src/components/Sidebar.logic.ts
index 7e42a8f8e63..6e359f85c58 100644
--- a/apps/web/src/components/Sidebar.logic.ts
+++ b/apps/web/src/components/Sidebar.logic.ts
@@ -13,7 +13,6 @@ import type { SidebarThreadSummary, Thread } from "../types";
import type { ThreadRouteTarget } from "../threadRoutes";
import { cn } from "../lib/utils";
import { isLatestTurnSettled } from "../session-logic";
-import { resolveServerBackedAppStageLabel } from "../branding.logic";
export const THREAD_SELECTION_SAFE_SELECTOR = "[data-thread-item], [data-thread-selection-safe]";
export const THREAD_JUMP_HINT_SHOW_DELAY_MS = 200;
@@ -170,13 +169,6 @@ export interface ThreadJumpHintVisibilityController {
dispose: () => void;
}
-export function resolveSidebarStageBadgeLabel(input: {
- primaryServerVersion: string | null | undefined;
- fallbackStageLabel: string;
-}): string {
- return resolveServerBackedAppStageLabel(input);
-}
-
export function createThreadJumpHintVisibilityController(input: {
delayMs: number;
onVisibilityChange: (visible: boolean) => void;
diff --git a/apps/web/src/pendingUserInput.test.ts b/apps/web/src/pendingUserInput.test.ts
index 3d1cb336e1f..2d4eaeace22 100644
--- a/apps/web/src/pendingUserInput.test.ts
+++ b/apps/web/src/pendingUserInput.test.ts
@@ -4,7 +4,6 @@ import {
buildPendingUserInputAnswers,
countAnsweredPendingUserInputQuestions,
derivePendingUserInputProgress,
- findFirstUnansweredPendingUserInputQuestionIndex,
resolvePendingUserInputAnswer,
setPendingUserInputCustomAnswer,
togglePendingUserInputOptionSelection,
@@ -182,29 +181,6 @@ describe("pending user input question progress", () => {
).toBe(1);
});
- it("finds the first unanswered question", () => {
- expect(
- findFirstUnansweredPendingUserInputQuestionIndex(questions, {
- scope: {
- selectedOptionLabels: ["Orchestration-first"],
- },
- }),
- ).toBe(1);
- });
-
- it("returns the last question index when all answers are complete", () => {
- expect(
- findFirstUnansweredPendingUserInputQuestionIndex(questions, {
- scope: {
- selectedOptionLabels: ["Orchestration-first"],
- },
- compat: {
- customAnswer: "Keep it for one release window",
- },
- }),
- ).toBe(1);
- });
-
it("derives the active question and advancement state", () => {
expect(
derivePendingUserInputProgress(
diff --git a/apps/web/src/pendingUserInput.ts b/apps/web/src/pendingUserInput.ts
index d3a7a129378..76868ad14a1 100644
--- a/apps/web/src/pendingUserInput.ts
+++ b/apps/web/src/pendingUserInput.ts
@@ -128,17 +128,6 @@ export function countAnsweredPendingUserInputQuestions(
}, 0);
}
-export function findFirstUnansweredPendingUserInputQuestionIndex(
- questions: ReadonlyArray<UserInputQuestion>,
- draftAnswers: Record<string, PendingUserInputDraftAnswer>,
-): number {
- const unansweredIndex = questions.findIndex(
- (question) => !resolvePendingUserInputAnswer(question, draftAnswers[question.id]),
- );
-
- return unansweredIndex === -1 ? Math.max(questions.length - 1, 0) : unansweredIndex;
-}
-
export function derivePendingUserInputProgress(
questions: ReadonlyArray<UserInputQuestion>,
draftAnswers: Record<string, PendingUserInputDraftAnswer>,
diff --git a/apps/web/src/providerUpdateDismissal.test.ts b/apps/web/src/providerUpdateDismissal.test.ts
deleted file mode 100644
index 732107cd804..00000000000
--- a/apps/web/src/providerUpdateDismissal.test.ts
+++ /dev/null
@@ -1,23 +0,0 @@
-import { beforeEach, describe, expect, it } from "vite-plus/test";
-
-import { removeLocalStorageItem } from "./hooks/useLocalStorage";
-import {
- dismissProviderUpdateNotification,
- isProviderUpdateNotificationDismissed,
- PROVIDER_UPDATE_DISMISSALS_STORAGE_KEY,
-} from "./providerUpdateDismissal";
-
-describe("providerUpdateDismissal", () => {
- beforeEach(() => {
- removeLocalStorageItem(PROVIDER_UPDATE_DISMISSALS_STORAGE_KEY);
- });
-
- it("persists provider update dismissals by notification key", () => {
- expect(isProviderUpdateNotificationDismissed("opencode:1.14.33")).toBe(false);
-
- dismissProviderUpdateNotification("opencode:1.14.33");
-
- expect(isProviderUpdateNotificationDismissed("opencode:1.14.33")).toBe(true);
- expect(isProviderUpdateNotificationDismissed("opencode:1.14.34")).toBe(false);
- });
-});
diff --git a/apps/web/src/providerUpdateDismissal.ts b/apps/web/src/providerUpdateDismissal.ts
index 28789152b34..ae18466c34e 100644
--- a/apps/web/src/providerUpdateDismissal.ts
+++ b/apps/web/src/providerUpdateDismissal.ts
@@ -1,67 +1,14 @@
import { useCallback, useMemo } from "react";
import * as Schema from "effect/Schema";
-import { getLocalStorageItem, setLocalStorageItem, useLocalStorage } from "./hooks/useLocalStorage";
+import { useLocalStorage } from "./hooks/useLocalStorage";
-export const PROVIDER_UPDATE_DISMISSALS_STORAGE_KEY = "t3code:provider-update-dismissals:v1";
+const PROVIDER_UPDATE_DISMISSALS_STORAGE_KEY = "t3code:provider-update-dismissals:v1";
const ProviderUpdateDismissalsSchema = Schema.Struct({
keys: Schema.Array(Schema.String),
});
-type ProviderUpdateDismissals = typeof ProviderUpdateDismissalsSchema.Type;
-
-function readProviderUpdateDismissals(): ProviderUpdateDismissals {
- try {
- return (
- getLocalStorageItem(
- PROVIDER_UPDATE_DISMISSALS_STORAGE_KEY,
- ProviderUpdateDismissalsSchema,
- ) ?? {
- keys: [],
- }
- );
- } catch (error) {
- console.error("Could not read provider-update dismissals.", error);
- return { keys: [] };
- }
-}
-
-function writeProviderUpdateDismissals(document: ProviderUpdateDismissals): void {
- try {
- setLocalStorageItem(
- PROVIDER_UPDATE_DISMISSALS_STORAGE_KEY,
- document,
- ProviderUpdateDismissalsSchema,
- );
- } catch (error) {
- console.error("Could not persist provider-update dismissals.", error);
- }
-}
-
-export function isProviderUpdateNotificationDismissed(
- dismissalKey: string | null | undefined,
-): boolean {
- if (!dismissalKey) {
- return false;
- }
- return readProviderUpdateDismissals().keys.includes(dismissalKey);
-}
-
-export function dismissProviderUpdateNotification(dismissalKey: string | null | undefined): void {
- const trimmedKey = dismissalKey?.trim();
- if (!trimmedKey) {
- return;
- }
- const document = readProviderUpdateDismissals();
- if (document.keys.includes(trimmedKey)) {
- return;
- }
- writeProviderUpdateDismissals({
- keys: [...document.keys, trimmedKey],
- });
-}
-
export function useDismissedProviderUpdateNotificationKeys() {
const [dismissals, setDismissals] = useLocalStorage(
PROVIDER_UPDATE_DISMISSALS_STORAGE_KEY,
diff --git a/apps/web/src/threadSync.test.ts b/apps/web/src/threadSync.test.ts
index ba91e33078f..dbdb7bb0834 100644
--- a/apps/web/src/threadSync.test.ts
+++ b/apps/web/src/threadSync.test.ts
@@ -1,6 +1,6 @@
import { describe, expect, it } from "vite-plus/test";
-import { resolveThreadSyncPhase, threadSyncLabel } from "./threadSync";
+import { resolveThreadSyncPhase } from "./threadSync";
describe("resolveThreadSyncPhase", () => {
it("loads when only shell data is available", () => {
@@ -40,10 +40,3 @@ describe("resolveThreadSyncPhase", () => {
).toBeNull();
});
});
-
-describe("threadSyncLabel", () => {
- it("uses the same loading and syncing language as mobile", () => {
- expect(threadSyncLabel("loading")).toBe("Loading messages...");
- expect(threadSyncLabel("syncing")).toBe("Syncing messages...");
- });
-});
diff --git a/apps/web/src/timestampFormat.test.ts b/apps/web/src/timestampFormat.test.ts
index 7cc61e02c72..578587510db 100644
--- a/apps/web/src/timestampFormat.test.ts
+++ b/apps/web/src/timestampFormat.test.ts
@@ -6,10 +6,7 @@ import {
formatExpiresInLabel,
formatRelativeTime,
formatRelativeTimeLabel,
- formatRelativeTimeUntil,
- formatRelativeTimeUntilLabel,
formatShortTimestamp,
- formatTimestamp,
getRelativeTimeState,
getTimestampFormatOptions,
resolveTimestampLocale,
@@ -76,33 +73,6 @@ describe("resolveTimestampLocale", () => {
});
});
-describe("formatRelativeTimeUntilLabel", () => {
- beforeEach(() => {
- vi.useFakeTimers();
- vi.setSystemTime(new Date("2026-04-07T12:00:00.000Z"));
- });
-
- afterEach(() => {
- vi.useRealTimers();
- });
-
- it("returns Expired when the instant is in the past", () => {
- expect(formatRelativeTimeUntilLabel("2026-04-07T11:59:00.000Z")).toBe("Expired");
- });
-
- it("formats seconds remaining", () => {
- expect(formatRelativeTimeUntilLabel("2026-04-07T12:00:45.000Z")).toBe("45s left");
- });
-
- it("formats minutes remaining", () => {
- expect(formatRelativeTimeUntilLabel("2026-04-07T12:15:00.000Z")).toBe("15m left");
- });
-
- it("formats hours remaining", () => {
- expect(formatRelativeTimeUntilLabel("2026-04-07T18:00:00.000Z")).toBe("6h left");
- });
-});
-
describe("formatExpiresInLabel", () => {
beforeEach(() => {
vi.useFakeTimers();
@@ -196,10 +166,6 @@ describe("formatDayAwareTimestamp", () => {
});
describe("invalid timestamp inputs", () => {
- it("returns an empty timestamp instead of throwing", () => {
- expect(formatTimestamp("not-a-date", "12-hour")).toBe("");
- });
-
it("returns an empty short timestamp instead of throwing", () => {
expect(formatShortTimestamp("not-a-date", "12-hour")).toBe("");
});
@@ -218,11 +184,6 @@ describe("invalid timestamp inputs", () => {
expect(formatElapsedDurationLabel("not-a-date")).toBe("");
});
- it("returns an empty relative time until label instead of a NaN label", () => {
- expect(formatRelativeTimeUntil("not-a-date")).toBeNull();
- expect(formatRelativeTimeUntilLabel("not-a-date")).toBe("");
- });
-
it("returns an empty expires-in label instead of a NaN label", () => {
expect(formatExpiresInLabel("not-a-date")).toBe("");
});
diff --git a/apps/web/src/timestampFormat.ts b/apps/web/src/timestampFormat.ts
index c1c30a54457..72ba711a1ad 100644
--- a/apps/web/src/timestampFormat.ts
+++ b/apps/web/src/timestampFormat.ts
@@ -78,12 +78,6 @@ export function parseTimestampDate(isoDate: string): Date | null {
return Number.isNaN(date.getTime()) ? null : date;
}
-export function formatTimestamp(isoDate: string, timestampFormat: TimestampFormat): string {
- const date = parseTimestampDate(isoDate);
- if (!date) return "";
- return getTimestampFormatter(timestampFormat, true).format(date);
-}
-
// Deliberately not the host locale: the tooltip's ordinal suffix and
// day-before-month order below are English, so a localized month alone would
// read "4th Juni 2026". Localizing the whole label is a separate change.
@@ -228,31 +222,6 @@ export function formatElapsedDurationLabel(isoDate: string, nowMs: number = Date
return `${days}d`;
}
-/**
- * Relative time until an ISO instant (e.g. expiry). Mirrors {@link formatRelativeTime} but for future times.
- */
-export function formatRelativeTimeUntil(isoDate: string): RelativeTimeParts | null {
- const date = parseTimestampDate(isoDate);
- if (!date) return null;
- const diffMs = date.getTime() - Date.now();
- if (diffMs <= 0) return { value: "Expired", suffix: null };
- const seconds = Math.floor(diffMs / 1000);
- if (seconds < 5) return { value: "Soon", suffix: null };
- if (seconds < 60) return { value: `${seconds}s`, suffix: "left" };
- const minutes = Math.floor(seconds / 60);
- if (minutes < 60) return { value: `${minutes}m`, suffix: "left" };
- const hours = Math.floor(minutes / 60);
- if (hours < 24) return { value: `${hours}h`, suffix: "left" };
- const days = Math.floor(hours / 24);
- return { value: `${days}d`, suffix: "left" };
-}
-
-export function formatRelativeTimeUntilLabel(isoDate: string): string {
- const relative = formatRelativeTimeUntil(isoDate);
- if (!relative) return "";
- return relative.suffix ? `${relative.value} ${relative.suffix}` : relative.value;
-}
-
/**
* Countdown for a future instant (e.g. link expiry): "Expires in 4m 12s", with second precision under one hour.
* Pass `nowMs` when a parent tick drives re-renders so the diff matches that snapshot.
diff --git a/apps/web/src/versionSkew.test.ts b/apps/web/src/versionSkew.test.ts
index 708ebc69269..963522ec53c 100644
--- a/apps/web/src/versionSkew.test.ts
+++ b/apps/web/src/versionSkew.test.ts
@@ -8,7 +8,6 @@ vi.mock("./branding", () => branding);
import { APP_VERSION } from "./branding";
import {
- appendVersionMismatchHint,
buildVersionMismatchDismissalKey,
dismissVersionMismatch,
isVersionMismatchDismissed,
@@ -139,14 +138,6 @@ describe("versionSkew", () => {
).toBe(false);
});
- it("appends a hint to connection errors when the server is behind", () => {
- const mismatch = resolveVersionMismatch("0.0.33");
-
- expect(appendVersionMismatchHint("Socket closed.", mismatch)).toBe(
- `Socket closed. Hint: ${MISMATCH_HINT}`,
- );
- });
-
it("reads desktop-managed update capabilities from config descriptors", () => {
expect(
resolveServerSelfUpdateCapability({
diff --git a/apps/web/src/versionSkew.ts b/apps/web/src/versionSkew.ts
index 594bff08168..dfa4f1eb0bb 100644
--- a/apps/web/src/versionSkew.ts
+++ b/apps/web/src/versionSkew.ts
@@ -159,17 +159,3 @@ export function dismissVersionMismatch(dismissalKey: string | null | undefined):
keys: [...document.keys, dismissalKey],
});
}
-
-export function appendVersionMismatchHint(
- message: string | null | undefined,
- mismatch: VersionMismatch | null | undefined,
-): string | null {
- const normalizedMessage = normalizeVersion(message);
- if (!normalizedMessage) {
- return mismatch?.hint ?? null;
- }
- if (!mismatch) {
- return normalizedMessage;
- }
- return `${normalizedMessage} Hint: ${mismatch.hint}`;
-}