Skip to content
TypeScript

test(clients): prune redundant checks and retain compatibility guards (#21850)

Julius Marminge2821004fd60e
diff --git a/apps/desktop/src/app/DesktopAppErrors.test.ts b/apps/desktop/src/app/DesktopAppErrors.test.ts
deleted file mode 100644
index 666c36d391d..00000000000
--- a/apps/desktop/src/app/DesktopAppErrors.test.ts
+++ /dev/null
@@ -1,30 +0,0 @@
-import { assert, describe, it } from "@effect/vitest";
-
-import {
- DesktopBackendPortUnavailableError,
- DesktopDevelopmentBackendPortRequiredError,
-} from "./DesktopApp.ts";
-
-describe("DesktopApp errors", () => {
- it("preserves unavailable backend port context", () => {
- const error = new DesktopBackendPortUnavailableError({
- startPort: 3_773,
- maxPort: 65_535,
- hosts: ["127.0.0.1", "0.0.0.0", "::"],
- });
-
- assert.equal(error.startPort, 3_773);
- assert.equal(error.maxPort, 65_535);
- assert.deepEqual(error.hosts, ["127.0.0.1", "0.0.0.0", "::"]);
- assert.equal(
- error.message,
- "No desktop backend port is available on hosts 127.0.0.1, 0.0.0.0, :: between 3773 and 65535.",
- );
- });
-
- it("reports the required development port", () => {
- const error = new DesktopDevelopmentBackendPortRequiredError();
-
- assert.equal(error.message, "T3CODE_PORT is required in desktop development.");
- });
-});
diff --git a/apps/desktop/src/app/DesktopDetachedActionErrors.test.ts b/apps/desktop/src/app/DesktopDetachedActionErrors.test.ts
deleted file mode 100644
index ae78080539b..00000000000
--- a/apps/desktop/src/app/DesktopDetachedActionErrors.test.ts
+++ /dev/null
@@ -1,37 +0,0 @@
-import { assert, describe, it } from "@effect/vitest";
-import * as Cause from "effect/Cause";
-
-import { DesktopLifecycleRelaunchError } from "./DesktopLifecycle.ts";
-import { DesktopApplicationMenuActionError } from "../window/DesktopApplicationMenu.ts";
-
-describe("desktop detached action errors", () => {
- it("preserves the complete relaunch failure cause and reason", () => {
- const cause = Cause.combine(
- Cause.fail(new Error("shutdown failed")),
- Cause.die(new Error("relaunch defect")),
- );
- const error = new DesktopLifecycleRelaunchError({
- reason: "apply update",
- cause,
- });
-
- assert.strictEqual(error.cause, cause);
- assert.equal(error.reason, "apply update");
- assert.equal(error.message, 'Desktop relaunch failed for reason "apply update".');
- });
-
- it("preserves the complete menu action failure cause and action", () => {
- const cause = Cause.combine(
- Cause.fail(new Error("window unavailable")),
- Cause.die(new Error("dispatch defect")),
- );
- const error = new DesktopApplicationMenuActionError({
- action: "open-settings",
- cause,
- });
-
- assert.strictEqual(error.cause, cause);
- assert.equal(error.action, "open-settings");
- assert.equal(error.message, 'Desktop menu action "open-settings" failed.');
- });
-});
diff --git a/apps/desktop/src/backend/DesktopBackendPool.test.ts b/apps/desktop/src/backend/DesktopBackendPool.test.ts
index 72a05e9d657..b4e2fbe9f14 100644
--- a/apps/desktop/src/backend/DesktopBackendPool.test.ts
+++ b/apps/desktop/src/backend/DesktopBackendPool.test.ts
@@ -1,5 +1,4 @@
import { assert, describe, it } from "@effect/vitest";
-import * as Duration from "effect/Duration";
import * as Effect from "effect/Effect";
import * as FileSystem from "effect/FileSystem";
import * as Layer from "effect/Layer";
@@ -19,29 +18,7 @@ import * as DesktopWindow from "../window/DesktopWindow.ts";
import * as DesktopWslEnvironment from "../wsl/DesktopWslEnvironment.ts";
import * as DesktopBackendConfiguration from "./DesktopBackendConfiguration.ts";
import * as DesktopBackendPool from "./DesktopBackendPool.ts";
-import type { DesktopBackendSnapshot, DesktopBackendStartConfig } from "./DesktopBackendManager.ts";
-
-function makeStubInstance(
- id: DesktopBackendPool.BackendInstanceId,
- label: string,
-): DesktopBackendPool.DesktopBackendInstance {
- const snapshot: DesktopBackendSnapshot = {
- desiredRunning: false,
- ready: false,
- activePid: Option.none(),
- restartAttempt: 0,
- restartScheduled: false,
- };
- return {
- id,
- label: Effect.succeed(label),
- start: Effect.void,
- stop: () => Effect.void,
- currentConfig: Effect.succeed(Option.none<DesktopBackendStartConfig>()),
- snapshot: Effect.succeed(snapshot),
- waitForReady: (_timeout: Duration.Duration) => Effect.succeed(false),
- };
-}
+import type { DesktopBackendStartConfig } from "./DesktopBackendManager.ts";
function layerPool(labelRef: Ref.Ref<string>): Layer.Layer<DesktopBackendPool.DesktopBackendPool> {
return DesktopBackendPool.layer.pipe(
@@ -111,36 +88,6 @@ function layerPool(labelRef: Ref.Ref<string>): Layer.Layer<DesktopBackendPool.De
}
describe("DesktopBackendPool", () => {
- it.effect("layerTest exposes registered instances by id", () =>
- Effect.gen(function* () {
- const pool = yield* DesktopBackendPool.DesktopBackendPool;
- const fetchedPrimary = yield* pool.get(DesktopBackendPool.PRIMARY_INSTANCE_ID);
- const fetchedWsl = yield* pool.get(DesktopBackendPool.BackendInstanceId("wsl:ubuntu"));
- const fetchedMissing = yield* pool.get(DesktopBackendPool.BackendInstanceId("missing"));
- const all = yield* pool.list;
- const resolvedPrimary = yield* pool.primary;
-
- assert.equal(yield* Option.getOrThrow(fetchedPrimary).label, "Windows");
- assert.equal(yield* Option.getOrThrow(fetchedWsl).label, "WSL (Ubuntu)");
- assert.isTrue(Option.isNone(fetchedMissing));
- assert.lengthOf(all, 2);
- assert.equal(resolvedPrimary.id, DesktopBackendPool.PRIMARY_INSTANCE_ID);
- }).pipe(
- Effect.provide(
- DesktopBackendPool.layerTest([
- makeStubInstance(DesktopBackendPool.PRIMARY_INSTANCE_ID, "Windows"),
- makeStubInstance(DesktopBackendPool.BackendInstanceId("wsl:ubuntu"), "WSL (Ubuntu)"),
- ]),
- ),
- ),
- );
-
- it.effect("layerTest dies when no instances are supplied", () =>
- Effect.exit(
- DesktopBackendPool.DesktopBackendPool.pipe(Effect.provide(DesktopBackendPool.layerTest([]))),
- ).pipe(Effect.map((exit) => assert.equal(exit._tag, "Failure"))),
- );
-
it.effect("resolves the primary label lazily after pool layer construction", () =>
Effect.scoped(
Effect.gen(function* () {
diff --git a/apps/mobile/src/features/connection/ConnectionFormField.test.tsx b/apps/mobile/src/features/connection/ConnectionFormField.test.tsx
deleted file mode 100644
index 9c9be070e21..00000000000
--- a/apps/mobile/src/features/connection/ConnectionFormField.test.tsx
+++ /dev/null
@@ -1,42 +0,0 @@
-import type { ReactNode } from "react";
-import { renderToStaticMarkup } from "react-dom/server";
-import { describe, expect, it, vi } from "vite-plus/test";
-
-vi.mock("react-native", () => ({
- View: ({ children }: { children: ReactNode }) => <div>{children}</div>,
-}));
-vi.mock("../../components/ui/AppText", () => ({
- AppText: ({
- accessibilityElementsHidden,
- importantForAccessibility,
- children,
- }: {
- accessibilityElementsHidden?: boolean;
- importantForAccessibility?: string;
- children: ReactNode;
- }) => (
- <span
- aria-hidden={
- accessibilityElementsHidden || importantForAccessibility === "no-hide-descendants"
- }
- >
- {children}
- </span>
- ),
- AppTextInput: ({ accessibilityLabel }: { accessibilityLabel?: string }) => (
- <input aria-label={accessibilityLabel} />
- ),
-}));
-
-import { ConnectionFormField } from "./ConnectionFormField";
-
-describe("ConnectionFormField accessibility", () => {
- it.each(["Host", "Pairing code"])("exposes %s once as the input name", (label) => {
- const markup = renderToStaticMarkup(
- <ConnectionFormField label={label} placeholder="Not an accessible name" />,
- );
-
- expect(markup).toContain(`<span aria-hidden="true">${label}</span>`);
- expect(markup).toContain(`<input aria-label="${label}"/>`);
- });
-});
diff --git a/apps/mobile/src/native/scrollEdgeEffects.test.ts b/apps/mobile/src/native/scrollEdgeEffects.test.ts
index cf7e590671c..4bf3afd037e 100644
--- a/apps/mobile/src/native/scrollEdgeEffects.test.ts
+++ b/apps/mobile/src/native/scrollEdgeEffects.test.ts
@@ -1,29 +1,9 @@
import { describe, expect, it } from "vite-plus/test";
-import { nativeHeaderScrollEdgeEffects, nativeTopScrollEdgeEffect } from "./scrollEdgeEffects";
+import { nativeTopScrollEdgeEffect } from "./scrollEdgeEffects";
describe("nativeTopScrollEdgeEffect", () => {
- it("keeps the automatic native treatment on iOS 26", () => {
- expect(nativeTopScrollEdgeEffect("ios", "26.5")).toBe("automatic");
- });
-
- it("keeps UIKit automatic scroll-edge sampling on iOS 27 and later", () => {
+ it("keeps UIKit content sampling instead of a local soft overlay on iOS 27", () => {
expect(nativeTopScrollEdgeEffect("ios", "27.0")).toBe("automatic");
- expect(nativeTopScrollEdgeEffect("ios", 28)).toBe("automatic");
- });
-
- it("does not apply the iOS workaround to other platforms", () => {
- expect(nativeTopScrollEdgeEffect("android", 27)).toBe("automatic");
- });
-});
-
-describe("nativeHeaderScrollEdgeEffects", () => {
- it("keeps non-top header edges hidden while applying the platform top effect", () => {
- expect(nativeHeaderScrollEdgeEffects("ios", "27.0")).toEqual({
- top: "automatic",
- bottom: "hidden",
- left: "hidden",
- right: "hidden",
- });
});
});
diff --git a/apps/mobile/src/state/thread-order.test.ts b/apps/mobile/src/state/thread-order.test.ts
index 5df8c3a8dc6..cf5a59b052b 100644
--- a/apps/mobile/src/state/thread-order.test.ts
+++ b/apps/mobile/src/state/thread-order.test.ts
@@ -90,7 +90,7 @@ describe("shared mobile pending move", () => {
expect(getPendingThreadOrder()).toBeNull();
});
- it.each(["failure", "interruption"])("releases a %s without restoring old canonical keys", () => {
+ it("releases a cancelled move without restoring old canonical keys", () => {
const { start, upsert } = fixture();
const move = start();
upsert("b", "aa");
diff --git a/apps/web/src/components/Sidebar.logic.test.ts b/apps/web/src/components/Sidebar.logic.test.ts
index de40918e409..59d524e2540 100644
--- a/apps/web/src/components/Sidebar.logic.test.ts
+++ b/apps/web/src/components/Sidebar.logic.test.ts
@@ -38,7 +38,6 @@ import {
resolveSidebarThreadStatus,
resolveSidebarV2TopStatus,
resolveThreadLastVisitedAt,
- resolveThreadRowClassName,
resolveThreadStatusPill,
resolveWorkingStartedAt,
pullRequestMatchesSearchQuery,
@@ -54,7 +53,6 @@ import {
sortProjectsForSidebar,
sortScopedProjectsForSidebar,
sortSidebarV2ProjectGroups,
- shouldCreateNewThreadInCurrentProject,
shouldNavigateAfterThreadPark,
THREAD_JUMP_HINT_SHOW_DELAY_MS,
type SidebarListItem,
@@ -63,7 +61,6 @@ import {
resolveSidebarDropVerb,
} from "./Sidebar.logic";
import { threadSearchMatchKey } from "@t3tools/client-runtime/state/thread-search";
-import { sortSettledThreads } from "@t3tools/client-runtime/state/thread-sort";
import { EnvironmentId, ProjectId, ProviderInstanceId, RunId, ThreadId } from "@t3tools/contracts";
import {
@@ -1790,43 +1787,6 @@ describe("sortProjectsForSidebar", () => {
]);
});
- it("ignores archived threads when sorting projects", () => {
- const sorted = sortProjectsForSidebar(
- [
- makeProject({
- id: ProjectId.make("project-1"),
- title: "Visible project",
- updatedAt: "2026-03-09T10:01:00.000Z",
- }),
- makeProject({
- id: ProjectId.make("project-2"),
- title: "Archived-only project",
- updatedAt: "2026-03-09T10:00:00.000Z",
- }),
- ],
- [
- makeThread({
- id: ThreadId.make("thread-visible"),
- projectId: ProjectId.make("project-1"),
- updatedAt: "2026-03-09T10:02:00.000Z",
- archivedAt: null,
- }),
- makeThread({
- id: ThreadId.make("thread-archived"),
- projectId: ProjectId.make("project-2"),
- updatedAt: "2026-03-09T10:10:00.000Z",
- archivedAt: "2026-03-09T10:11:00.000Z",
- }),
- ].filter((thread) => thread.archivedAt === null),
- "updated_at",
- );
-
- expect(sorted.map((project) => project.id)).toEqual([
- ProjectId.make("project-1"),
- ProjectId.make("project-2"),
- ]);
- });
-
it.each(["updated_at", "created_at"] as const)(
"matches the per-comparison %s order on a shuffled list with ties",
(sortOrder) => {
diff --git a/apps/web/src/components/Sidebar.logic.ts b/apps/web/src/components/Sidebar.logic.ts
index d0bd3b95838..6e80cfcd730 100644
--- a/apps/web/src/components/Sidebar.logic.ts
+++ b/apps/web/src/components/Sidebar.logic.ts
@@ -23,7 +23,7 @@ import {
type ThreadSortInput,
} from "../lib/threadSort";
import type { SidebarThreadSummary, Thread } from "../types";
-import { cn, normalizeSearchText } from "../lib/utils";
+import { normalizeSearchText } from "../lib/utils";
import { isLatestRunSettled } from "../session-logic";
import { resolveServerBackedAppStageLabel } from "../branding.logic";
@@ -876,40 +876,6 @@ export function isContextMenuPointerDown(input: {
return input.isMac && input.button === 0 && input.ctrlKey;
}
-export function resolveThreadRowClassName(input: {
- isActive: boolean;
- isSelected: boolean;
-}): string {
- const baseClassName =
- "h-8 w-full translate-x-0 cursor-pointer justify-start rounded-md px-2 text-left text-sm select-none focus-visible:ring-1 focus-visible:ring-inset focus-visible:ring-ring";
-
- if (input.isSelected && input.isActive) {
- return cn(
- baseClassName,
- "bg-sidebar-row-active text-sidebar-foreground font-medium hover:bg-sidebar-row-active hover:text-sidebar-foreground",
- );
- }
-
- if (input.isSelected) {
- return cn(
- baseClassName,
- "bg-sidebar-row-selected text-sidebar-foreground hover:bg-sidebar-row-active hover:text-sidebar-foreground",
- );
- }
-
- if (input.isActive) {
- return cn(
- baseClassName,
- "bg-sidebar-row-active text-sidebar-foreground font-medium hover:bg-sidebar-row-active hover:text-sidebar-foreground",
- );
- }
-
- return cn(
- baseClassName,
- "text-sidebar-muted-foreground/80 hover:bg-sidebar-row-hover hover:text-sidebar-foreground",
- );
-}
-
export type SidebarThreadStatus =
| "approval"
| "input"
diff --git a/apps/web/src/components/chat/pendingDraftWork.test.ts b/apps/web/src/components/chat/pendingDraftWork.test.ts
index 935556ab459..2f5fe807999 100644
--- a/apps/web/src/components/chat/pendingDraftWork.test.ts
+++ b/apps/web/src/components/chat/pendingDraftWork.test.ts
@@ -42,15 +42,6 @@ describe("PendingDraftWork", () => {
expect(pending.has("isolated-a")).toBe(false);
});
- it("keeps a claim on the draft across a remount of the composer", async () => {
- const { pendingDraftWork: first } = await import("./pendingDraftWork");
- first.begin("remounted");
- const { pendingDraftWork: second } = await import("./pendingDraftWork");
- expect(second.has("remounted")).toBe(true);
- second.end("remounted");
- expect(first.has("remounted")).toBe(false);
- });
-
it("does not go negative when a transfer ends twice", () => {
const pending = pendingDraftWork;
pending.begin("double-end");
diff --git a/apps/web/src/components/chat/workspaceFileDrop.test.ts b/apps/web/src/components/chat/workspaceFileDrop.test.ts
index e7efc2864f2..c7b05177a04 100644
--- a/apps/web/src/components/chat/workspaceFileDrop.test.ts
+++ b/apps/web/src/components/chat/workspaceFileDrop.test.ts
@@ -70,13 +70,14 @@ describe("makeWorkspaceFileDropHandlers", () => {
it("forwards dropped files and clears the active state", () => {
const file = new File(["contents"], "example.txt", { type: "text/plain" });
- const { host, setDragActive, addFiles } = makeHost();
+ const { host, setDragActive, addFiles, addFolders } = makeHost();
const { event } = makeDragEvent({ files: [file] });
makeWorkspaceFileDropHandlers(host).onDrop(event);
expect(setDragActive).toHaveBeenCalledWith(false);
expect(addFiles).toHaveBeenCalledWith([file]);
+ expect(addFolders).not.toHaveBeenCalled();
});
it("routes mixed drops to files and folders", () => {
@@ -120,15 +121,4 @@ describe("makeWorkspaceFileDropHandlers", () => {
expect(addFiles).not.toHaveBeenCalled();
expect(addFolders).toHaveBeenCalledWith([folder]);
});
-
- it("uses files when the browser does not expose drag items", () => {
- const file = new File(["contents"], "example.txt", { type: "text/plain" });
- const { host, addFiles, addFolders } = makeHost();
- const { event } = makeDragEvent({ files: [file] });
-
- makeWorkspaceFileDropHandlers(host).onDrop(event);
-
- expect(addFiles).toHaveBeenCalledWith([file]);
- expect(addFolders).not.toHaveBeenCalled();
- });
});
diff --git a/apps/web/src/components/clerk/clerkAppearance.test.ts b/apps/web/src/components/clerk/clerkAppearance.test.ts
index 18ecb7b23fe..7ab07aff137 100644
--- a/apps/web/src/components/clerk/clerkAppearance.test.ts
+++ b/apps/web/src/components/clerk/clerkAppearance.test.ts
@@ -51,34 +51,17 @@ const builtInThemeModes = [
);
describe("clerkAppearance", () => {
- it("maps theme colors without overriding Clerk's component structure", () => {
- expect(clerkAppearance).toEqual({
- variables: {
- colorPrimary: "var(--update-foreground)",
- colorPrimaryForeground: "var(--card)",
- colorDanger: "var(--error)",
- colorSuccess: "var(--success)",
- colorWarning: "var(--warning)",
- colorNeutral: "var(--contrast-foreground)",
- colorForeground: "var(--contrast-foreground)",
- colorMuted: "color-mix(in srgb, var(--card) 98%, var(--contrast-foreground))",
- colorMutedForeground: "var(--contrast-muted-foreground)",
- colorBackground: "var(--card)",
- colorInputForeground: "var(--contrast-foreground)",
- colorInput: "var(--secondary)",
- colorRing: "var(--ring)",
- },
- elements: {
- formFieldErrorText: { color: "var(--error-foreground)" },
- formFieldWarningText: { color: "var(--warning-foreground)" },
- formFieldSuccessText: { color: "var(--success-foreground)" },
- otpCodeFieldErrorText: { color: "var(--error-foreground)" },
- otpCodeFieldSuccessText: { color: "var(--success-foreground)" },
- },
- });
- });
-
it.each(builtInThemeModes)("keeps Clerk text readable across a built-in palette", (colors) => {
+ expect(clerkAppearance.variables).toMatchObject({
+ colorForeground: "var(--contrast-foreground)",
+ colorBackground: "var(--card)",
+ colorMutedForeground: "var(--contrast-muted-foreground)",
+ colorMuted: "color-mix(in srgb, var(--card) 98%, var(--contrast-foreground))",
+ colorInputForeground: "var(--contrast-foreground)",
+ colorInput: "var(--secondary)",
+ colorPrimary: "var(--update-foreground)",
+ colorPrimaryForeground: "var(--card)",
+ });
const mutedSurface = mixThemeColors(colors.surface, colors.text, 0.98);
expect(contrastRatio(colors.text, colors.surface)).toBeGreaterThanOrEqual(4.5);
diff --git a/apps/web/src/components/pullRequest/pullRequestReactions.logic.test.ts b/apps/web/src/components/pullRequest/pullRequestReactions.logic.test.ts
index f7aa346fae0..ed17c7b466f 100644
--- a/apps/web/src/components/pullRequest/pullRequestReactions.logic.test.ts
+++ b/apps/web/src/components/pullRequest/pullRequestReactions.logic.test.ts
@@ -3,9 +3,6 @@ import { describe, expect, it } from "vite-plus/test";
import {
applyPendingPullRequestReactions,
- PULL_REQUEST_REACTION_ORDER,
- pullRequestReactionEmoji,
- pullRequestReactionName,
pullRequestReactionTooltip,
} from "./pullRequestReactions.logic";
@@ -19,33 +16,6 @@ function reaction(overrides: Partial<PullRequestReaction> = {}): PullRequestReac
};
}
-describe("reaction presentation", () => {
- it("names and draws all eight, in GitHub's picker order", () => {
- expect(PULL_REQUEST_REACTION_ORDER).toEqual([
- "thumbs-up",
- "thumbs-down",
- "laugh",
- "hooray",
- "confused",
- "heart",
- "rocket",
- "eyes",
- ]);
- expect(PULL_REQUEST_REACTION_ORDER.map(pullRequestReactionEmoji)).toEqual([
- "πŸ‘",
- "πŸ‘Ž",
- "πŸ˜„",
- "πŸŽ‰",
- "πŸ˜•",
- "❀️",
- "πŸš€",
- "πŸ‘€",
- ]);
- expect(pullRequestReactionName("thumbs-up")).toBe("thumbs up");
- expect(pullRequestReactionName("eyes")).toBe("eyes");
- });
-});
-
describe("reaction tooltip", () => {
it("reads as GitHub's sentence for one, two and three names", () => {
expect(
diff --git a/apps/web/src/composer-logic.test.ts b/apps/web/src/composer-logic.test.ts
index 7050dc6251d..4c7bad292d4 100644
--- a/apps/web/src/composer-logic.test.ts
+++ b/apps/web/src/composer-logic.test.ts
@@ -876,21 +876,6 @@ describe("assistant citation cursor offsets", () => {
});
});
-describe("replaceTextRange trailing space consumption", () => {
- it("double space after insertion when replacement ends with space", () => {
- const text = "and then @AG summarize";
- const rangeStart = "and then ".length;
- const rangeEnd = "and then @AG".length;
-
- const withoutConsume = replaceTextRange(text, rangeStart, rangeEnd, "@AGENTS.md ");
- expect(withoutConsume.text).toBe("and then @AGENTS.md summarize");
-
- const extendedEnd = text[rangeEnd] === " " ? rangeEnd + 1 : rangeEnd;
- const withConsume = replaceTextRange(text, rangeStart, extendedEnd, "@AGENTS.md ");
- expect(withConsume.text).toBe("and then @AGENTS.md summarize");
- });
-});
-
describe("isCollapsedCursorAdjacentToInlineToken", () => {
it("returns false when no mention exists", () => {
expect(isCollapsedCursorAdjacentToInlineToken("plain text", 6, "left")).toBe(false);
diff --git a/packages/client-runtime/src/environment/knownEnvironment.test.ts b/packages/client-runtime/src/environment/knownEnvironment.test.ts
index 032be152fdb..b22a22008b2 100644
--- a/packages/client-runtime/src/environment/knownEnvironment.test.ts
+++ b/packages/client-runtime/src/environment/knownEnvironment.test.ts
@@ -43,17 +43,6 @@ describe("scoped refs", () => {
expect(scopedThreadKey(threadRef)).toBe("environment-test:thread-1");
});
- it("returns typed scoped refs", () => {
- expect(projectRef).toEqual({
- environmentId,
- projectId: ProjectId.make("project-1"),
- });
- expect(threadRef).toEqual({
- environmentId,
- threadId: ThreadId.make("thread-1"),
- });
- });
-
it("parses scoped project and thread keys back into refs", () => {
expect(parseScopedProjectKey("environment-test:project-1")).toEqual(projectRef);
expect(parseScopedThreadKey("environment-test:thread-1")).toEqual(threadRef);
diff --git a/packages/client-runtime/src/state/runtime.test.ts b/packages/client-runtime/src/state/runtime.test.ts
index e31092acc75..c389f454186 100644
--- a/packages/client-runtime/src/state/runtime.test.ts
+++ b/packages/client-runtime/src/state/runtime.test.ts
@@ -11,7 +11,6 @@ import * as Cause from "effect/Cause";
import * as Deferred from "effect/Deferred";
import * as Effect from "effect/Effect";
import * as Exit from "effect/Exit";
-import * as Fiber from "effect/Fiber";
import * as Latch from "effect/Latch";
import * as Layer from "effect/Layer";
import * as Option from "effect/Option";
@@ -1065,115 +1064,6 @@ describe("environment query lifecycle", () => {
);
});
-describe("Atom.fn mutation semantics", () => {
- it.effect("interrupts the previous invocation when the same mutation atom is written again", () =>
- Effect.gen(function* () {
- const firstLatch = Latch.makeUnsafe();
- const secondLatch = Latch.makeUnsafe();
- const interrupted: string[] = [];
- const mutation = Atom.fn((id: "first" | "second") =>
- (id === "first" ? firstLatch : secondLatch).await.pipe(
- Effect.as(id),
- Effect.onInterrupt(() =>
- Effect.sync(() => {
- interrupted.push(id);
- }),
- ),
- ),
- );
- const registry = AtomRegistry.make();
- const unmount = registry.mount(mutation);
-
- registry.set(mutation, "first");
- registry.set(mutation, "second");
- yield* Effect.yieldNow;
-
- expect(interrupted).toEqual(["first"]);
-
- secondLatch.openUnsafe();
- expect(
- yield* AtomRegistry.getResult(registry, mutation, {
- suspendOnWaiting: true,
- }),
- ).toBe("second");
-
- unmount();
- registry.dispose();
- }),
- );
-
- it.effect("keeps stream mutations waiting until the final emitted value", () =>
- Effect.gen(function* () {
- const completionLatch = Latch.makeUnsafe();
- const mutation = Atom.fn(() =>
- Stream.make("progress").pipe(
- Stream.concat(Stream.fromEffect(completionLatch.await.pipe(Effect.as("done")))),
- ),
- );
- const registry = AtomRegistry.make();
- const unmount = registry.mount(mutation);
-
- registry.set(mutation, undefined);
-
- const progress = registry.get(mutation);
- expect(AsyncResult.isSuccess(progress)).toBe(true);
- if (AsyncResult.isSuccess(progress)) {
- expect(progress.value).toBe("progress");
- expect(progress.waiting).toBe(true);
- }
-
- completionLatch.openUnsafe();
- expect(
- yield* AtomRegistry.getResult(registry, mutation, {
- suspendOnWaiting: true,
- }),
- ).toBe("done");
-
- unmount();
- registry.dispose();
- }),
- );
-
- it.effect(
- "allows concurrent effects to finish but does not correlate results to individual writes",
- () =>
- Effect.gen(function* () {
- const firstLatch = Latch.makeUnsafe();
- const secondLatch = Latch.makeUnsafe();
- const mutation = Atom.fn<never, "first" | "second", "first" | "second">(
- (id: "first" | "second") =>
- (id === "first" ? firstLatch : secondLatch).await.pipe(Effect.as(id)),
- { concurrent: true },
- );
- const registry = AtomRegistry.make();
- const unmount = registry.mount(mutation);
-
- registry.set(mutation, "first");
- const firstResult = yield* AtomRegistry.getResult(registry, mutation, {
- suspendOnWaiting: true,
- }).pipe(Effect.forkChild({ startImmediately: true }));
- registry.set(mutation, "second");
- const secondResult = yield* AtomRegistry.getResult(registry, mutation, {
- suspendOnWaiting: true,
- }).pipe(Effect.forkChild({ startImmediately: true }));
-
- secondLatch.openUnsafe();
- yield* Effect.yieldNow;
-
- const stillWaiting = registry.get(mutation);
- expect(stillWaiting.waiting).toBe(true);
-
- firstLatch.openUnsafe();
-
- expect(yield* Fiber.join(firstResult)).toBe("first");
- expect(yield* Fiber.join(secondResult)).toBe("first");
-
- unmount();
- registry.dispose();
- }),
- );
-});
-
describe("executeAtomQuery", () => {
it("keeps concurrent query results correlated to their atoms", async () => {
const firstLatch = Latch.makeUnsafe();
diff --git a/packages/client-runtime/src/work-log/commandLabel.test.ts b/packages/client-runtime/src/work-log/commandLabel.test.ts
index f6394ee87c5..a7226bf4854 100644
--- a/packages/client-runtime/src/work-log/commandLabel.test.ts
+++ b/packages/client-runtime/src/work-log/commandLabel.test.ts
@@ -163,13 +163,14 @@ describe("commandProgramName", () => {
expect(commandProgramName(command)).toBe(program);
});
- it.each(
- ["cd /tmp", "export CI=1", "unset DEBUG", "source env.sh", ". env.sh"].flatMap((setup) =>
- ["&&", " || ", ";", "\n", "|", " |& ", " & "].map(
- (operator) => [`${setup}${operator}npm test`, "npm"] as const,
- ),
+ it.each([
+ ...["&&", " || ", ";", "\n", "|", " |& ", " & "].map(
+ (operator) => [`cd /tmp${operator}npm test`, "npm"] as const,
+ ),
+ ...["export CI=1", "unset DEBUG", "source env.sh", ". env.sh"].map(
+ (setup) => [`${setup}&&npm test`, "npm"] as const,
),
- )("handles shell setup followed by every command separator: %s", (command, program) => {
+ ])("handles shell setup followed by every command separator: %s", (command, program) => {
expect(commandProgramName(command)).toBe(program);
});