Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions apps/web/src/components/ChatMarkdown.permissions.browser.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ import { expect, it, vi } from "vite-plus/test";
import { userEvent } from "vite-plus/test/browser";

import { act, render } from "../../test/render";
// useSettings loads the mocked command module while threads.ts is still evaluating,
// so the factory reads threadEnvironment from here instead of importing it itself.
import { threadEnvironment } from "../state/threads";
import { useRightPanelStore } from "../rightPanelStore";

const state = vi.hoisted(() => ({
Expand All @@ -32,18 +35,15 @@ vi.mock(import("../state/use-atom-query-runner"), async (original) => ({
...(await original()),
useAtomQueryRunner: (() => state.search) as never,
}));
vi.mock(import("../state/use-atom-command"), async (original) => {
const { threadEnvironment } = await import("../state/threads");
return {
...(await original()),
useAtomCommand: ((command: unknown) =>
command === threadEnvironment.linkPullRequest
? state.link
: command === threadEnvironment.unlinkPullRequest
? state.unlink
: state.openEditor) as never,
};
});
vi.mock(import("../state/use-atom-command"), async (original) => ({
...(await original()),
useAtomCommand: ((command: unknown) =>
command === threadEnvironment.linkPullRequest
? state.link
: command === threadEnvironment.unlinkPullRequest
? state.unlink
: state.openEditor) as never,
}));
vi.mock(import("../state/session"), async (original) => {
const { useSyncExternalStore } = await import("react");
const readEnvironmentScope = (id: EnvironmentId | null, scope: AuthEnvironmentScope) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ vi.mock(import("../../state/entities"), () => ({
useHiddenThreadKeys: (() => new Set()) as never,
useAnyEnvironmentHiding: (() => false) as never,
}));
vi.mock(import("../../state/environments"), () => ({
vi.mock(import("../../state/environments"), async (original) => ({
...(await original()),
useEnvironment: (() => null) as never,
useEnvironmentProviders: (() => new Map()) as never,
}));
Expand Down
Loading