Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(clients): Open approval opens a delegated child on its own machine #28260

Closedsimonpratte(GitHub profile, opens in a new tab)wants to merge 2 commits intomain fromrefs/pull/28260/headopened View on GitHub

Showing 1 changed file with 30 additions and 0 deletions.

x
0 of 1 viewed, 1 left
30 additions and 0 deletionsapps/web/src/components/chat/ThreadActivityBanners.browser.test.tsxAdded
View file
@@ -0,0 +1,30 @@
+import { EnvironmentId, ThreadId } from "@t3tools/contracts";
+import type { EnvironmentThreadShell } from "@t3tools/client-runtime/state/shell";
+import { expect, it, vi } from "vite-plus/test";
+​
+import { render } from "../../../test/render";
+import { childInputNowItem } from "./ThreadActivityBanners";
+​
+it("opens a delegated child's approval on the environment it runs on", async () => {
+ const remoteEnvironmentId = EnvironmentId.make("remote-environment");
+ const childId = ThreadId.make("remote-helper");
+ // The item reads only these fields.
+ const child = {
+ id: childId,
+ environmentId: remoteEnvironmentId,
+ title: "Reference test on remote",
+ hasPendingApprovals: true,
+ lineage: { sideChat: false },
+ } as EnvironmentThreadShell;
+ const onOpenThread = vi.fn();
+ const item = childInputNowItem({
+ childThreadInputs: [child],
+ parentAwaitingUser: false,
+ onOpenThread,
+ });
+​
+ await using screen = await render(<>{item?.actions}</>);
+ await screen.getByRole("button", { name: "Open approval" }).click();
+​
+ expect(onOpenThread).toHaveBeenCalledWith(childId, remoteEnvironmentId);
+});