authorgravatar for julius0216@outlook.comJulius Marminge <julius0216@outlook.com> 2026-09-05 01:56:48-07:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-09-05 01:56:48-07:00
log19ea3c5beb4cd93dd19f51f3e7c6d760357b41df
tree1c1cd43fe1db0cea8f4e739b152ce9881665571d
parent38812c101e562c4f8d9bea7b1a592a4b02954a39
signature Signed by PGP key B5690EEEBB952194

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


1 files changed, 0 insertions(+), 65 deletions(-)

apps/web/src/components/diffs/AnnotatableCodeView.test.tsx deleted-65
...@@ -1,65 +0,0 @@
1import type { ReactNode } from "react";
2import { renderToStaticMarkup } from "react-dom/server";
3import { beforeEach, describe, expect, it, vi } from "vite-plus/test";
4
5const testState = vi.hoisted(() => ({
6 codeViewOptions: null as Record<string, unknown> | null,
7}));
8
9vi.mock("@pierre/diffs/react", () => ({
10 CodeView: (props: { options: Record<string, unknown> }) => {
11 testState.codeViewOptions = props.options;
12 return null;
13 },
14}));
15
16vi.mock("../DiffWorkerPoolProvider", () => ({
17 DiffWorkerPoolProvider: ({ children }: { children?: ReactNode }) => children,
18}));
19
20vi.mock("~/composerDraftStore", () => ({
21 useComposerDraftStore: (selector: (store: Record<string, unknown>) => unknown) =>
22 selector({
23 addReviewComment: vi.fn(),
24 removeReviewComment: vi.fn(),
25 getComposerDraft: () => undefined,
26 }),
27}));
28
29vi.mock("./DiffCommentAnnotation", () => ({
30 DiffCommentAnnotation: () => null,
31}));
32
33vi.mock("../files/fileCommentAnnotations", () => ({
34 nextFileCommentId: () => "comment-test",
35}));
36
37import { AnnotatableCodeView } from "./AnnotatableCodeView";
38
39describe("AnnotatableCodeView", () => {
40 beforeEach(() => {
41 testState.codeViewOptions = null;
42 });
43
44 it("opens comments from Pierre's gutter action without ending line selection", () => {
45 renderToStaticMarkup(
46 <AnnotatableCodeView
47 codeViewKey="test-view"
48 files={[]}
49 sectionId="working-tree"
50 sectionTitle="Working tree"
51 composerDraftTarget={"draft-test" as never}
52 options={{}}
53 renderHeaderPrefix={() => null}
54 renderHeaderFilenameSuffix={() => null}
55 />,
56 );
57
58 expect(testState.codeViewOptions).toMatchObject({
59 enableGutterUtility: true,
60 enableLineSelection: true,
61 onGutterUtilityClick: expect.any(Function),
62 });
63 expect(testState.codeViewOptions).not.toHaveProperty("onLineSelectionEnd");
64 });
65});