TypeScript
test: prune trivial error and layout tests (#8400)
t3-code[bot]f6f2be32d8bc
diff --git a/apps/server/scripts/cliErrors.test.ts b/apps/server/scripts/cliErrors.test.tsdeleted file mode 100644index 91754290db9..00000000000--- a/apps/server/scripts/cliErrors.test.ts+++ /dev/null@@ -1,31 +0,0 @@-import { assert, describe, it } from "@effect/vitest";--import { ServerCliBuildAssetMissingError, ServerCliCommandExitError } from "./cliErrors.ts";--describe("server CLI errors", () => {- it("preserves failed command context without changing its message", () => {- const error = new ServerCliCommandExitError({- command: "vp",- args: ["pm", "publish"],- cwd: "/repo",- exitCode: 17,- });-- assert.equal(error._tag, "ServerCliCommandExitError");- assert.equal(error.command, "vp");- assert.deepEqual(error.args, ["pm", "publish"]);- assert.equal(error.cwd, "/repo");- assert.equal(error.exitCode, 17);- assert.equal(error.message, "Command exited with non-zero exit code (17)");- });-- it("preserves a representative missing asset path", () => {- const error = new ServerCliBuildAssetMissingError({ assetPath: "/repo/server.mjs" });-- assert.equal(error.assetPath, "/repo/server.mjs");- assert.equal(- error.message,- "Missing build asset: /repo/server.mjs. Run the build subcommand first.",- );- });-});diff --git a/apps/server/src/checkpointing/Errors.test.ts b/apps/server/src/checkpointing/Errors.test.tsdeleted file mode 100644index 4c8b9c59cc3..00000000000--- a/apps/server/src/checkpointing/Errors.test.ts+++ /dev/null@@ -1,39 +0,0 @@-import { expect, it } from "@effect/vitest";-import { ThreadId } from "@t3tools/contracts";--import {- CheckpointRefUnavailableError,- CheckpointTurnRangeUnavailableError,- CheckpointWorkspacePathMissingError,-} from "./Errors.ts";--const threadId = ThreadId.make("thread-1");--it("derives checkpoint messages from structured context", () => {- const range = new CheckpointTurnRangeUnavailableError({- operation: "CheckpointDiffQuery.getTurnDiff",- threadId,- requestedTurnCount: 4,- availableTurnCount: 2,- });- const checkpoint = new CheckpointRefUnavailableError({- operation: "CheckpointDiffQuery.getTurnDiff",- threadId,- turnCount: 2,- checkpoint: "to",- });- const workspace = new CheckpointWorkspacePathMissingError({- operation: "CheckpointDiffQuery.getFullThreadDiff",- threadId,- });-- expect(range.message).toBe(- "Checkpoint unavailable for thread thread-1 turn 4: Turn diff range exceeds current turn count: requested 4, current 2.",- );- expect(checkpoint.message).toBe(- "Checkpoint unavailable for thread thread-1 turn 2: Checkpoint ref is unavailable for turn 2.",- );- expect(workspace.message).toBe(- "Checkpoint invariant violation in CheckpointDiffQuery.getFullThreadDiff: Workspace path missing for thread 'thread-1' when computing full thread diff.",- );-});diff --git a/apps/server/src/terminal/PtyAdapter.test.ts b/apps/server/src/terminal/PtyAdapter.test.tsdeleted file mode 100644index f4ac9516537..00000000000--- a/apps/server/src/terminal/PtyAdapter.test.ts+++ /dev/null@@ -1,34 +0,0 @@-import { assert, describe, it } from "@effect/vitest";-import * as Schema from "effect/Schema";--import * as PtyAdapter from "./PtyAdapter.ts";--const isPtySpawnError = Schema.is(PtyAdapter.PtySpawnError);--describe("PtySpawnError", () => {- it("derives messages from structural context while preserving the full cause chain", () => {- const spawnCause = new Error("spawn /bin/zsh ENOENT");- const adapterError = new PtyAdapter.PtySpawnError({- adapter: "node-pty",- shell: "/bin/zsh",- cause: spawnCause,- });- const managerError = new PtyAdapter.PtySpawnError({- adapter: "terminal-manager",- attemptedShells: ["/bin/zsh -o nopromptsp", "/bin/bash"],- cause: adapterError,- });-- assert(isPtySpawnError(managerError));- assert.strictEqual(- managerError.message,- "Failed to spawn PTY process with terminal-manager. Tried shells: /bin/zsh -o nopromptsp, /bin/bash.",- );- assert.strictEqual(- adapterError.message,- "Failed to spawn PTY process '/bin/zsh' with node-pty.",- );- assert.strictEqual(managerError.cause, adapterError);- assert.strictEqual(adapterError.cause, spawnCause);- });-});diff --git a/apps/web/src/components/threadSidebarWidth.test.ts b/apps/web/src/components/threadSidebarWidth.test.tsdeleted file mode 100644index e38d5c3749b..00000000000--- a/apps/web/src/components/threadSidebarWidth.test.ts+++ /dev/null@@ -1,48 +0,0 @@-// @effect-diagnostics nodeBuiltinImport:off - Regression coverage compares the sidebar component with its width contract.-import * as NodeFS from "node:fs";--import { describe, expect, it } from "vite-plus/test";--import {- resolveInitialThreadSidebarWidth,- THREAD_MAIN_CONTENT_MIN_WIDTH,- THREAD_SIDEBAR_DEFAULT_WIDTH,- THREAD_SIDEBAR_MIN_WIDTH,-} from "./threadSidebarWidth";--describe("thread sidebar width", () => {- it("uses the default width when no preference is stored", () => {- expect(resolveInitialThreadSidebarWidth(null, 1200)).toBe(THREAD_SIDEBAR_DEFAULT_WIDTH);- });-- it("uses a stored width in the initial render", () => {- expect(resolveInitialThreadSidebarWidth(360, 1200)).toBe(360);- });-- it("clamps a stored width to the sidebar minimum", () => {- expect(resolveInitialThreadSidebarWidth(120, 1200)).toBe(THREAD_SIDEBAR_MIN_WIDTH);- });-- it("leaves enough room for the main content on a smaller window", () => {- const viewportWidth = 1000;-- expect(resolveInitialThreadSidebarWidth(900, viewportWidth)).toBe(- viewportWidth - THREAD_MAIN_CONTENT_MIN_WIDTH,- );- });-- it("keeps the sidebar minimum when the whole layout is narrower than its minimums", () => {- expect(resolveInitialThreadSidebarWidth(900, 700)).toBe(THREAD_SIDEBAR_MIN_WIDTH);- });-- it("shows the desktop wordmark across the sidebar's full legal width range", () => {- const sidebarSource = NodeFS.readFileSync(- new URL("./sidebar/SidebarChrome.tsx", import.meta.url),- "utf8",- );-- expect(sidebarSource).toContain("hidden h-7 w-fit min-w-0 shrink-0 items-center gap-1");- expect(sidebarSource).toContain("md:flex");- expect(THREAD_SIDEBAR_MIN_WIDTH).toBe(13 * 16);- });-});diff --git a/apps/web/src/components/threadSidebarWidth.ts b/apps/web/src/components/threadSidebarWidth.tsindex 93dd196e84d..27589d8f200 100644--- a/apps/web/src/components/threadSidebarWidth.ts+++ b/apps/web/src/components/threadSidebarWidth.ts@@ -1,5 +1,5 @@export const THREAD_SIDEBAR_WIDTH_STORAGE_KEY = "chat_thread_sidebar_width";-export const THREAD_SIDEBAR_DEFAULT_WIDTH = 16 * 16;+const THREAD_SIDEBAR_DEFAULT_WIDTH = 16 * 16;export const THREAD_SIDEBAR_MIN_WIDTH = 13 * 16;export const THREAD_MAIN_CONTENT_MIN_WIDTH = 40 * 16;diff --git a/packages/client-runtime/src/state/session.test.ts b/packages/client-runtime/src/state/session.test.tsdeleted file mode 100644index fe1dcdbe3f2..00000000000--- a/packages/client-runtime/src/state/session.test.ts+++ /dev/null@@ -1,21 +0,0 @@-import { describe, expect, it } from "@effect/vitest";-import * as Effect from "effect/Effect";-import * as Option from "effect/Option";-import * as Schema from "effect/Schema";--import { initialConfigOption } from "./session.ts";--class TestConfigError extends Schema.TaggedErrorClass<TestConfigError>()("TestConfigError", {- message: Schema.String,-}) {}--describe("environment session state", () => {- it.effect("turns an initial config failure into an empty value", () =>- Effect.gen(function* () {- const result = yield* initialConfigOption(- Effect.fail(new TestConfigError({ message: "temporary failure" })),- );- expect(Option.isNone(result)).toBe(true);- }),- );-});diff --git a/packages/client-runtime/src/state/session.ts b/packages/client-runtime/src/state/session.tsindex 31fd297da3f..43adb980f3a 100644--- a/packages/client-runtime/src/state/session.ts+++ b/packages/client-runtime/src/state/session.ts@@ -16,7 +16,7 @@ import { executeEnvironmentHttpRequest, makeEnvironmentHttpApiClient } from "../import { buildEnvironmentAuthHeaders, withEnvironmentCredentials } from "./environmentHttpAuth.ts";import { followStreamInEnvironment } from "./runtime.ts";-export function initialConfigOption<E>(+function initialConfigOption<E>(initialConfig: Effect.Effect<ServerConfig, E>,): Effect.Effect<Option.Option<ServerConfig>> {return initialConfig.pipe(diff --git a/packages/shared/src/String.test.ts b/packages/shared/src/String.test.tsdeleted file mode 100644index a32b6f28ebf..00000000000--- a/packages/shared/src/String.test.ts+++ /dev/null@@ -1,17 +0,0 @@-import { describe, expect, it } from "vite-plus/test";--import { truncate } from "./String.ts";--describe("truncate", () => {- it("trims surrounding whitespace", () => {- expect(truncate(" hello world ")).toBe("hello world");- });-- it("returns shorter strings unchanged", () => {- expect(truncate("alpha", 10)).toBe("alpha");- });-- it("truncates long strings and appends an ellipsis", () => {- expect(truncate("abcdefghij", 5)).toBe("abcde...");- });-});diff --git a/scripts/lib/resolve-catalog.test.ts b/scripts/lib/resolve-catalog.test.tsdeleted file mode 100644index ae9a2291157..00000000000--- a/scripts/lib/resolve-catalog.test.ts+++ /dev/null@@ -1,20 +0,0 @@-import { assert, it } from "@effect/vitest";--import { CatalogDependencyResolutionError, resolveCatalogDependencies } from "./resolve-catalog.ts";--it("reports unresolved catalog dependencies with lookup context", () => {- try {- resolveCatalogDependencies({ effect: "catalog:runtime" }, {}, "apps/server");- assert.fail("Expected catalog resolution to fail.");- } catch (error) {- assert.instanceOf(error, CatalogDependencyResolutionError);- assert.equal(error.workspacePackage, "apps/server");- assert.equal(error.dependencyName, "effect");- assert.equal(error.catalogSpec, "catalog:runtime");- assert.equal(error.catalogKey, "runtime");- assert.equal(- error.message,- "Unable to resolve 'catalog:runtime' for apps/server dependency 'effect'. Expected key 'runtime' in root workspace catalog.",- );- }-});diff --git a/scripts/lib/resolve-catalog.ts b/scripts/lib/resolve-catalog.tsindex eb9d4cc78c8..0380cf48efb 100644--- a/scripts/lib/resolve-catalog.ts+++ b/scripts/lib/resolve-catalog.ts@@ -1,6 +1,6 @@import * as Schema from "effect/Schema";-export class CatalogDependencyResolutionError extends Schema.TaggedErrorClass<CatalogDependencyResolutionError>()(+class CatalogDependencyResolutionError extends Schema.TaggedErrorClass<CatalogDependencyResolutionError>()("CatalogDependencyResolutionError",{workspacePackage: Schema.String,