Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

PreviewView.test.tsx

654 lines20.2 KB

1import {
2 BUILT_IN_BROWSER_PROFILES,
3 DEFAULT_BROWSER_PROFILE_ID,
4 DEFAULT_PREVIEW_APPEARANCE,
5 DEFAULT_PREVIEW_ZOOM_FACTOR,
6 EnvironmentId,
7 FILL_PREVIEW_VIEWPORT,
8 ThreadId,
9} from "@t3tools/contracts";
10import { act, createElement, Profiler } from "react";
11import { renderToStaticMarkup } from "react-dom/server";
12import { beforeEach, describe, expect, it, vi } from "vite-plus/test";
13​
14const mocks = vi.hoisted(() => ({
15 navigate: vi.fn(async (_tabId: string, _url: string): Promise<void> => undefined),
16 rememberPreviewUrl: vi.fn(),
17 readPreparedConnection: vi.fn(() => ({ httpBaseUrl: "http://172.25.85.75:3773" })),
18 submittedUrl: null as ((url: string) => void) | null,
19 emptyStateUrl: null as ((url: string) => void) | null,
20 togglePictureInPicture: null as (() => void) | null,
21 toggleNativePictureInPicture: null as (() => void) | null,
22 pictureInPicturePressed: false,
23 miniPlayerTabId: null as string | null,
24 openMiniPlayer: vi.fn(),
25 closeMiniPlayer: vi.fn(),
26 closeRightPanel: vi.fn(),
27 openPictureInPicture: vi.fn(async (_tabId: string): Promise<void> => undefined),
28 closePictureInPicture: vi.fn(async (_tabId: string): Promise<void> => undefined),
29 pickElement: vi.fn(),
30 addPreviewAnnotation: vi.fn(),
31 addImage: vi.fn(),
32 toggleAnnotation: null as (() => void) | null,
33 pictureInPicture: false,
34 showEmptyState: false,
35 loading: false,
36 serverEpoch: null as string | null,
37 recordingTabIds: new Set<string>(),
38 recordingRuntimeTabId: null as string | null,
39 recordVisitForThread: vi.fn(),
40}));
41​
42const EMPTY_HISTORY: never[] = [];
43​
44const STUB_BROWSER_DEFAULTS = {
45 viewport: FILL_PREVIEW_VIEWPORT,
46 zoomFactor: DEFAULT_PREVIEW_ZOOM_FACTOR,
47 appearance: DEFAULT_PREVIEW_APPEARANCE,
48 autoShowFloatingPreview: true,
49 profiles: BUILT_IN_BROWSER_PROFILES,
50 profileId: DEFAULT_BROWSER_PROFILE_ID,
51};
52​
53vi.mock("~/browserHistoryStore", () => ({
54 recordVisitForThread: mocks.recordVisitForThread,
55 setTitleForThreadUrl: vi.fn(),
56 removeUrlForThread: vi.fn(),
57 BROWSER_HISTORY_MAX_ENTRIES_PER_PROJECT: 50,
58 useThreadRecentHistory: () => EMPTY_HISTORY,
59}));
60​
61vi.mock("~/state/session", async (importOriginal) => ({
62 ...(await importOriginal<typeof import("~/state/session")>()),
63 readPreparedConnection: mocks.readPreparedConnection,
64}));
65​
66// Stubbed at the direct dependency rather than letting the real module pull in
67// `useSettings` -> `state/server`, which would drag the whole settings and
68// connection graph into a test that only cares about the browser chrome.
69vi.mock("~/browser/browserDefaults", () => ({
70 useBrowserDefaults: () => STUB_BROWSER_DEFAULTS,
71 getBrowserDefaults: () => STUB_BROWSER_DEFAULTS,
72 browserDefaultOpenViewport: () => FILL_PREVIEW_VIEWPORT,
73 browserDefaultOpenProfileId: () => DEFAULT_BROWSER_PROFILE_ID,
74 browserDefaultTabState: () => ({
75 zoomFactor: DEFAULT_PREVIEW_ZOOM_FACTOR,
76 colorScheme: DEFAULT_PREVIEW_APPEARANCE,
77 }),
78 browserResponsiveViewportForToggle: () => ({
79 _tag: "freeform" as const,
80 width: 1024,
81 height: 768,
82 }),
83}));
84​
85vi.mock("~/composerDraftStore", () => ({
86 useComposerDraftStore: (
87 select: (store: { addPreviewAnnotation: () => void; addImage: () => void }) => unknown,
88 ) =>
89 select({
90 addPreviewAnnotation: mocks.addPreviewAnnotation,
91 addImage: mocks.addImage,
92 }),
93}));
94​
95vi.mock("~/localApi", () => ({
96 ensureLocalApi: vi.fn(),
97}));
98​
99vi.mock("~/previewStateStore", () => ({
100 rememberPreviewUrl: mocks.rememberPreviewUrl,
101 updatePreviewServerSnapshot: vi.fn(),
102 useThreadPreviewState: () => ({
103 activeTabId: "tab-1",
104 serverEpoch: mocks.serverEpoch,
105 desktopByTabId: {
106 "tab-1": {
107 hasWebContents: true,
108 canGoBack: false,
109 canGoForward: false,
110 loading: mocks.loading,
111 zoomFactor: 1,
112 pictureInPicture: mocks.pictureInPicture,
113 colorScheme: "system",
114 audioMuted: false,
115 audible: false,
116 controller: "none",
117 },
118 },
119 recentlySeenUrls: [],
120 sessions: mocks.showEmptyState
121 ? {}
122 : {
123 "tab-1": {
124 threadId: "thread-1",
125 tabId: "tab-1",
126 navStatus: {
127 _tag: "Success",
128 url: "http://example.com/",
129 title: "Example",
130 },
131 canGoBack: false,
132 canGoForward: false,
133 updatedAt: "2026-07-13T00:00:00.000Z",
134 },
135 },
136 }),
137}));
138​
139vi.mock("~/state/environments", () => ({
140 useEnvironment: () => ({ label: "WSL" }),
141 useEnvironmentHttpBaseUrl: () => "http://172.25.85.75:3773",
142}));
143​
144vi.mock("~/state/preview", () => ({
145 previewEnvironment: { open: {}, resize: {} },
146}));
147​
148vi.mock("~/state/use-atom-command", () => ({
149 useAtomCommand: () => vi.fn(),
150}));
151​
152vi.mock("~/browser/browserRecording", () => ({
153 findActiveBrowserRecordingRuntimeTabId: () => mocks.recordingRuntimeTabId,
154 isBrowserRecordingStartCancelledError: vi.fn(() => false),
155 startBrowserRecording: vi.fn(),
156 stopBrowserRecording: vi.fn(),
157 useActiveBrowserRecordingTabIds: () => mocks.recordingTabIds,
158}));
159​
160vi.mock("~/browser/browserSurfaceStore", () => ({
161 useBrowserSurfaceStore: (
162 select: (state: { byTabId: Record<string, { rect?: unknown }> }) => unknown,
163 ) => select({ byTabId: {} }),
164}));
165​
166vi.mock("~/previewMiniPlayerStore", () => {
167 const usePreviewMiniPlayerStore = Object.assign(
168 (select: (state: unknown) => unknown) =>
169 select({
170 byThreadKey: mocks.miniPlayerTabId
171 ? {
172 "environment-1:thread-1": {
173 source: { kind: "browser", tabId: mocks.miniPlayerTabId },
174 position: null,
175 },
176 }
177 : {},
178 }),
179 {
180 getState: () => ({
181 open: mocks.openMiniPlayer,
182 close: mocks.closeMiniPlayer,
183 }),
184 },
185 );
186 return {
187 browserMiniPlayerSource: (tabId: string) => ({ kind: "browser", tabId }),
188 selectThreadPreviewMiniPlayerTabId: (
189 byThreadKey: Record<string, { source: { tabId: string }; position: null }>,
190 ) => byThreadKey["environment-1:thread-1"]?.source.tabId ?? null,
191 usePreviewMiniPlayerStore,
192 };
193});
194​
195vi.mock("~/rightPanelStore", () => ({
196 useRightPanelStore: {
197 getState: () => ({ close: mocks.closeRightPanel }),
198 },
199}));
200​
201vi.mock("~/components/ui/toast", () => ({
202 stackedThreadToast: vi.fn(),
203 toastManager: { add: vi.fn() },
204}));
205​
206vi.mock("./previewBridge", () => ({
207 previewBridge: {
208 navigate: mocks.navigate,
209 pickElement: mocks.pickElement,
210 pictureInPicture: {
211 open: mocks.openPictureInPicture,
212 close: mocks.closePictureInPicture,
213 },
214 },
215}));
216​
217vi.mock("./PreviewChromeRow", () => ({
218 PreviewChromeRow: (props: {
219 onSubmit: (url: string) => void;
220 onPickElement?: () => void;
221 onPictureInPicture?: () => void;
222 pictureInPicture?: boolean;
223 trailingActions?: {
224 props: { onNativePictureInPicture?: () => void };
225 };
226 }) => {
227 mocks.submittedUrl = props.onSubmit;
228 mocks.toggleAnnotation = props.onPickElement ?? null;
229 mocks.togglePictureInPicture = props.onPictureInPicture ?? null;
230 mocks.toggleNativePictureInPicture =
231 props.trailingActions?.props.onNativePictureInPicture ?? null;
232 mocks.pictureInPicturePressed = props.pictureInPicture ?? false;
233 return null;
234 },
235}));
236​
237vi.mock("./PreviewEmptyState", () => ({
238 PreviewEmptyState: (props: { onOpenUrl: (url: string) => void }) => {
239 mocks.emptyStateUrl = props.onOpenUrl;
240 return null;
241 },
242}));
243vi.mock("./PreviewMoreMenu", () => ({
244 PreviewMoreMenu: (props: { onNativePictureInPicture: () => void }) => {
245 mocks.toggleNativePictureInPicture = props.onNativePictureInPicture;
246 return null;
247 },
248}));
249vi.mock("./PreviewUnreachable", () => ({ PreviewUnreachable: () => null }));
250vi.mock("./ZoomIndicator", () => ({ ZoomIndicator: () => null }));
251vi.mock("./AgentBrowserCursor", () => ({
252 AgentBrowserCursor: () => createElement("agent-cursor"),
253}));
254vi.mock("~/browser/BrowserSurfaceSlot", () => ({ BrowserSurfaceSlot: () => null }));
255vi.mock("./usePreviewSession", () => ({ usePreviewSession: vi.fn() }));
256​
257import { PreviewView } from "./PreviewView";
258import { toastManager } from "~/components/ui/toast";
259import { previewRuntimeTabId } from "~/browser/previewRuntimeTabId";
260​
261const TEST_THREAD_REF = {
262 environmentId: EnvironmentId.make("environment-1"),
263 threadId: ThreadId.make("thread-1"),
264} as const;
265const TEST_RUNTIME_TAB_ID = previewRuntimeTabId(TEST_THREAD_REF, null, "tab-1");
266​
267// ReactDOM needs a host, but this unit suite intentionally has no DOM dependency.
268class TestNode {
269 parentNode: TestNode | null = null;
270 childNodes: TestNode[] = [];
271 readonly nodeName: string;
272 readonly tagName: string;
273 readonly namespaceURI = "http://www.w3.org/1999/xhtml";
274 readonly style = {};
275​
276 constructor(
277 name: string,
278 readonly ownerDocument: TestNode | null = null,
279 readonly nodeType = 1,
280 ) {
281 this.nodeName = name.toUpperCase();
282 this.tagName = this.nodeName;
283 }
284​
285 set textContent(_value: string) {
286 this.childNodes = [];
287 }
288​
289 appendChild(child: TestNode) {
290 child.parentNode = this;
291 this.childNodes.push(child);
292 return child;
293 }
294​
295 removeChild(child: TestNode) {
296 this.childNodes.splice(this.childNodes.indexOf(child), 1);
297 child.parentNode = null;
298 return child;
299 }
300​
301 createElement(name: string) {
302 return new TestNode(name, this);
303 }
304​
305 addEventListener() {}
306 removeEventListener() {}
307 setAttribute() {}
309​
310function installTestDom() {
311 const document = new TestNode("#document", null, 9);
312 const window = {
313 document,
314 HTMLIFrameElement: TestNode,
315 setInterval: globalThis.setInterval,
316 clearInterval: globalThis.clearInterval,
317 setTimeout: globalThis.setTimeout,
318 clearTimeout: globalThis.clearTimeout,
319 addEventListener() {},
320 removeEventListener() {},
321 };
322 vi.stubGlobal("document", document);
323 vi.stubGlobal("window", window);
324 vi.stubGlobal("HTMLIFrameElement", window.HTMLIFrameElement);
325 vi.stubGlobal("IS_REACT_ACT_ENVIRONMENT", true);
326 return document;
328​
329describe("PreviewView navigation", () => {
330 beforeEach(() => {
331 mocks.navigate.mockClear();
332 mocks.rememberPreviewUrl.mockClear();
333 mocks.readPreparedConnection.mockClear();
334 mocks.submittedUrl = null;
335 mocks.emptyStateUrl = null;
336 mocks.togglePictureInPicture = null;
337 mocks.toggleNativePictureInPicture = null;
338 mocks.pictureInPicturePressed = false;
339 mocks.miniPlayerTabId = null;
340 mocks.openMiniPlayer.mockClear();
341 mocks.closeMiniPlayer.mockClear();
342 mocks.closeRightPanel.mockClear();
343 mocks.openPictureInPicture.mockClear();
344 mocks.closePictureInPicture.mockClear();
345 mocks.pickElement.mockReset();
346 mocks.addPreviewAnnotation.mockClear();
347 vi.mocked(toastManager.add).mockClear();
348 mocks.addImage.mockClear();
349 mocks.toggleAnnotation = null;
350 mocks.pictureInPicture = false;
351 mocks.showEmptyState = false;
352 mocks.loading = false;
353 mocks.serverEpoch = null;
354 mocks.recordingTabIds = new Set();
355 mocks.recordingRuntimeTabId = null;
356 mocks.recordVisitForThread.mockClear();
357 });
358​
359 it("shows the cursor in a replacement browser while the old instance still records", async () => {
360 const document = installTestDom();
361 const { createRoot } = await import("react-dom/client");
362 const container = document.createElement("div");
363 const root = createRoot(container as unknown as Element);
364 const hasCursor = (node: TestNode): boolean =>
365 node.nodeName === "AGENT-CURSOR" || node.childNodes.some(hasCursor);
366 mocks.recordingTabIds.add(TEST_RUNTIME_TAB_ID);
367 mocks.recordingRuntimeTabId = TEST_RUNTIME_TAB_ID;
368 try {
369 await act(() => {
370 root.render(<PreviewView threadRef={TEST_THREAD_REF} tabId="tab-1" visible />);
371 });
372 expect(hasCursor(container)).toBe(false);
373 mocks.serverEpoch = "replacement-server";
374 await act(() => {
375 root.render(<PreviewView threadRef={TEST_THREAD_REF} tabId="tab-1" visible />);
376 });
377 expect(hasCursor(container)).toBe(true);
378 expect(mocks.recordingTabIds.has(TEST_RUNTIME_TAB_ID)).toBe(true);
379 } finally {
380 await act(() => root.unmount());
381 vi.unstubAllGlobals();
382 }
383 });
384​
385 it("does not rerender while loading time passes", async () => {
386 vi.useFakeTimers();
387 mocks.loading = true;
388 const document = installTestDom();
389 const { createRoot } = await import("react-dom/client");
390 const root = createRoot(document.createElement("div") as unknown as Element);
391 const onRender = vi.fn();
392​
393 try {
394 await act(() => {
395 root.render(
396 <Profiler id="preview" onRender={onRender}>
397 <PreviewView threadRef={TEST_THREAD_REF} tabId="tab-1" visible />
398 </Profiler>,
399 );
400 });
401 const initialRenderCount = onRender.mock.calls.length;
402​
403 await act(() => vi.advanceTimersByTimeAsync(1_000));
404​
405 expect(onRender).toHaveBeenCalledTimes(initialRenderCount);
406 } finally {
407 await act(() => root.unmount());
408 vi.useRealTimers();
409 vi.unstubAllGlobals();
410 }
411 });
412​
413 it.each([
414 [
415 "https://localhost:8000/dashboard?mode=test#top",
416 "https://localhost:8000/dashboard?mode=test#top",
417 ],
418 ["localhost:5173/app", "http://localhost:5173/app"],
419 ])("preserves a direct localhost URL in a WSL environment", async (submitted, expected) => {
420 renderToStaticMarkup(
421 <PreviewView
422 threadRef={{
423 environmentId: EnvironmentId.make("environment-1"),
424 threadId: ThreadId.make("thread-1"),
425 }}
426 tabId="tab-1"
427 visible
428 />,
429 );
430​
431 expect(mocks.submittedUrl).not.toBeNull();
432 mocks.submittedUrl?.(submitted);
433​
434 await vi.waitFor(() =>
435 expect(mocks.navigate).toHaveBeenCalledWith(TEST_RUNTIME_TAB_ID, expected),
436 );
437 expect(mocks.rememberPreviewUrl).toHaveBeenCalledWith(
438 {
439 environmentId: "environment-1",
440 threadId: "thread-1",
441 },
442 expected,
443 );
444 });
445​
446 it("records a history visit with the normalized requested url on submit", async () => {
447 renderToStaticMarkup(
448 <PreviewView
449 threadRef={{
450 environmentId: EnvironmentId.make("environment-1"),
451 threadId: ThreadId.make("thread-1"),
452 }}
453 tabId="tab-1"
454 visible
455 />,
456 );
457​
458 mocks.submittedUrl?.("localhost:3000/admin");
459 await vi.waitFor(() => {
460 expect(mocks.recordVisitForThread).toHaveBeenCalledWith(
461 expect.objectContaining({ threadId: expect.anything() }),
462 "http://localhost:3000/admin",
463 );
464 });
465 });
466​
467 it("maps an empty-state localhost server onto the WSL host", async () => {
468 mocks.showEmptyState = true;
469 renderToStaticMarkup(
470 <PreviewView
471 threadRef={{
472 environmentId: EnvironmentId.make("environment-1"),
473 threadId: ThreadId.make("thread-1"),
474 }}
475 tabId="tab-1"
476 visible
477 />,
478 );
479​
480 expect(mocks.emptyStateUrl).not.toBeNull();
481 mocks.emptyStateUrl?.("http://localhost:5173/app?mode=test#top");
482​
483 await vi.waitFor(() =>
484 expect(mocks.navigate).toHaveBeenCalledWith(
485 TEST_RUNTIME_TAB_ID,
486 "http://172.25.85.75:5173/app?mode=test#top",
487 ),
488 );
489 expect(mocks.rememberPreviewUrl).toHaveBeenCalledWith(
490 {
491 environmentId: "environment-1",
492 threadId: "thread-1",
493 },
494 "http://172.25.85.75:5173/app?mode=test#top",
495 );
496 await vi.waitFor(() =>
497 expect(mocks.recordVisitForThread).toHaveBeenCalledWith(
498 expect.objectContaining({ threadId: expect.anything() }),
499 "http://localhost:5173/app?mode=test#top",
500 ),
501 );
502 });
503​
504 it("opens and closes a thread-scoped floating preview for the active tab", async () => {
505 const props = {
506 threadRef: {
507 environmentId: EnvironmentId.make("environment-1"),
508 threadId: ThreadId.make("thread-1"),
509 },
510 tabId: "tab-1",
511 visible: true,
512 } as const;
513​
514 renderToStaticMarkup(<PreviewView {...props} />);
515 expect(mocks.pictureInPicturePressed).toBe(false);
516 mocks.togglePictureInPicture?.();
517 expect(mocks.openMiniPlayer).toHaveBeenCalledWith(props.threadRef, {
518 kind: "browser",
519 tabId: "tab-1",
520 });
521 expect(mocks.closeRightPanel).toHaveBeenCalledWith(props.threadRef);
522​
523 mocks.miniPlayerTabId = "tab-1";
524 renderToStaticMarkup(<PreviewView {...props} />);
525 expect(mocks.pictureInPicturePressed).toBe(true);
526 mocks.togglePictureInPicture?.();
527 expect(mocks.closeMiniPlayer).toHaveBeenCalledWith(props.threadRef);
528 });
529​
530 it("keeps the native preview window as a secondary action", async () => {
531 const props = {
532 threadRef: {
533 environmentId: EnvironmentId.make("environment-1"),
534 threadId: ThreadId.make("thread-1"),
535 },
536 tabId: "tab-1",
537 visible: true,
538 } as const;
539​
540 renderToStaticMarkup(<PreviewView {...props} />);
541 mocks.toggleNativePictureInPicture?.();
542 await vi.waitFor(() =>
543 expect(mocks.openPictureInPicture).toHaveBeenCalledWith(TEST_RUNTIME_TAB_ID),
544 );
545​
546 mocks.pictureInPicture = true;
547 renderToStaticMarkup(<PreviewView {...props} />);
548 mocks.toggleNativePictureInPicture?.();
549 await vi.waitFor(() =>
550 expect(mocks.closePictureInPicture).toHaveBeenCalledWith(TEST_RUNTIME_TAB_ID),
551 );
552 });
553​
554 it("forwards Cmd/Ctrl+Enter annotations to the composer send path", async () => {
555 const annotation = {
556 id: "annotation-1",
557 pageUrl: "https://example.com/dashboard",
558 pageTitle: "Dashboard",
559 comment: "Tighten this spacing",
560 elements: [],
561 regions: [],
562 strokes: [],
563 styleChanges: [],
564 screenshot: null,
565 createdAt: "2026-07-27T00:00:00.000Z",
566 };
567 const onSendAnnotation = vi.fn();
568 mocks.pickElement.mockResolvedValue({ annotation, submission: "send" });
569​
570 renderToStaticMarkup(
571 <PreviewView
572 threadRef={TEST_THREAD_REF}
573 tabId="tab-1"
574 visible
575 onSendAnnotation={onSendAnnotation}
576 />,
577 );
578 mocks.toggleAnnotation?.();
579​
580 await vi.waitFor(() => expect(onSendAnnotation).toHaveBeenCalledWith(annotation, null));
581 expect(mocks.addPreviewAnnotation).toHaveBeenCalledWith(TEST_THREAD_REF, annotation);
582 });
583​
584 it("warns when main dropped the crop before handing over the pick", async () => {
585 const annotation = {
586 id: "annotation-3",
587 pageUrl: "https://example.com/dashboard",
588 pageTitle: "Dashboard",
589 comment: "Tighten this spacing",
590 elements: [],
591 regions: [],
592 strokes: [],
593 styleChanges: [],
594 screenshot: null,
595 createdAt: "2026-07-27T00:00:00.000Z",
596 };
597 const onSendAnnotation = vi.fn();
598 mocks.pickElement.mockResolvedValue({ annotation, submission: "send", screenshotFailed: true });
599​
600 renderToStaticMarkup(
601 <PreviewView
602 threadRef={TEST_THREAD_REF}
603 tabId="tab-1"
604 visible
605 onSendAnnotation={onSendAnnotation}
606 />,
607 );
608 mocks.toggleAnnotation?.();
609​
610 await vi.waitFor(() => expect(onSendAnnotation).toHaveBeenCalledWith(annotation, null));
611 // A null screenshot alone looks like a comment-only pick; the flag is what
612 // separates "no crop requested" from "crop lost to a timeout".
613 expect(toastManager.add).toHaveBeenCalledTimes(1);
614 });
615​
616 it("still sends annotation text when the picked element's crop is malformed", async () => {
617 const annotation = {
618 id: "annotation-2",
619 pageUrl: "https://example.com/dashboard",
620 pageTitle: "Dashboard",
621 comment: "Tighten this spacing",
622 elements: [],
623 regions: [],
624 strokes: [],
625 styleChanges: [],
626 screenshot: {
627 dataUrl: "data:image/png;base64,%%%",
628 width: 10,
629 height: 10,
630 cropRect: { x: 0, y: 0, width: 10, height: 10 },
631 },
632 createdAt: "2026-07-27T00:00:00.000Z",
633 };
634 const onSendAnnotation = vi.fn();
635 mocks.pickElement.mockResolvedValue({ annotation, submission: "send" });
636​
637 renderToStaticMarkup(
638 <PreviewView
639 threadRef={TEST_THREAD_REF}
640 tabId="tab-1"
641 visible
642 onSendAnnotation={onSendAnnotation}
643 />,
644 );
645 mocks.toggleAnnotation?.();
646​
647 // The forwarded and stored annotation both drop the screenshot, so the
648 // prompt does not claim a crop that was never attached.
649 const sent = { ...annotation, screenshot: null };
650 await vi.waitFor(() => expect(onSendAnnotation).toHaveBeenCalledWith(sent, null));
651 expect(mocks.addPreviewAnnotation).toHaveBeenCalledWith(TEST_THREAD_REF, sent);
652 expect(mocks.addImage).not.toHaveBeenCalled();
653 });
654});