test: prune trivial error and layout tests (#8400)

Co-authored-by: t3-code[bot] <269035359+t3-code[bot]@users.noreply.github.com>
Co-authored-by: Julius Marminge <[email protected]>
This commit is contained in:
t3-code[bot]andJulius Marminge authored and GitHub committed 2026-08-27 13:50:17 +00:00
1 parent 73f8cfc023
commit f6f2be32d8
10 files changed
+3 -213

No files matched your search

-31
View File
@@ -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.",
);
});
});
@@ -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.",
);
});
@@ -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);
});
});
@@ -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);
});
});
@@ -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;
@@ -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);
}),
);
});
+1 -1
View File
@@ -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(
-17
View File
@@ -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...");
});
});
-20
View File
@@ -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.",
);
}
});
+1 -1
View File
@@ -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,