test(web): remove mocked annotation options snapshot (#10074)

This commit is contained in:
Julius Marminge authored and GitHub committed 2026-09-05 01:56:48 -07:00
1 parent 38812c101e
commit 19ea3c5beb
1 file changed
-65
@@ -1,65 +0,0 @@
import type { ReactNode } from "react";
import { renderToStaticMarkup } from "react-dom/server";
import { beforeEach, describe, expect, it, vi } from "vite-plus/test";
const testState = vi.hoisted(() => ({
codeViewOptions: null as Record<string, unknown> | null,
}));
vi.mock("@pierre/diffs/react", () => ({
CodeView: (props: { options: Record<string, unknown> }) => {
testState.codeViewOptions = props.options;
return null;
},
}));
vi.mock("../DiffWorkerPoolProvider", () => ({
DiffWorkerPoolProvider: ({ children }: { children?: ReactNode }) => children,
}));
vi.mock("~/composerDraftStore", () => ({
useComposerDraftStore: (selector: (store: Record<string, unknown>) => unknown) =>
selector({
addReviewComment: vi.fn(),
removeReviewComment: vi.fn(),
getComposerDraft: () => undefined,
}),
}));
vi.mock("./DiffCommentAnnotation", () => ({
DiffCommentAnnotation: () => null,
}));
vi.mock("../files/fileCommentAnnotations", () => ({
nextFileCommentId: () => "comment-test",
}));
import { AnnotatableCodeView } from "./AnnotatableCodeView";
describe("AnnotatableCodeView", () => {
beforeEach(() => {
testState.codeViewOptions = null;
});
it("opens comments from Pierre's gutter action without ending line selection", () => {
renderToStaticMarkup(
<AnnotatableCodeView
codeViewKey="test-view"
files={[]}
sectionId="working-tree"
sectionTitle="Working tree"
composerDraftTarget={"draft-test" as never}
options={{}}
renderHeaderPrefix={() => null}
renderHeaderFilenameSuffix={() => null}
/>,
);
expect(testState.codeViewOptions).toMatchObject({
enableGutterUtility: true,
enableLineSelection: true,
onGutterUtilityClick: expect.any(Function),
});
expect(testState.codeViewOptions).not.toHaveProperty("onLineSelectionEnd");
});
});