Skip to content

Commit 9d9ba21

Browse files
committed
test(mobile): give main's media test mocks the asset scope context
filePreview.test.ts and useMediaVideoPlayback.test.tsx came from main and mock ThreadMarkdownImage without MarkdownImageAssetScopeContext, which this branch renders around assistant messages and reads in ThreadMarkdownVideo.
1 parent 234bd50 commit 9d9ba21

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

‎apps/mobile/src/lib/filePreview.test.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,10 @@ vi.mock("../features/threads/thread-workflow-opening", () => ({ useWorkflowOpeni
283283
vi.mock("../features/threads/useFileChipShare", () => ({ useFileChipShare: () => vi.fn() }));
284284
vi.mock("../features/threads/ThreadMarkdownImage", async () => {
285285
const { createContext } = await import("react");
286-
return { MarkdownImageAvailableWidthContext: createContext(390) };
286+
return {
287+
MarkdownImageAvailableWidthContext: createContext(390),
288+
MarkdownImageAssetScopeContext: createContext<string | undefined>(undefined),
289+
};
287290
});
288291
vi.mock("../features/review/ReviewCommentCard", () => ({ useReviewCommentColors: () => ({}) }));
289292
vi.mock("../features/prompt-links/prompt-link-actions", () => ({}));

‎apps/mobile/src/lib/useMediaVideoPlayback.test.tsx‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,13 @@ vi.mock("../components/FilePreviewGallery", () => ({
108108
}));
109109
vi.mock("../components/FilePreviewModal", () => ({ FilePreviewModal: () => null }));
110110
vi.mock("../components/VideoPreviewModal", () => ({ VideoPreviewModal: () => null }));
111-
vi.mock("../features/threads/ThreadMarkdownImage", () => ({ ThreadMarkdownImageView: () => null }));
111+
vi.mock("../features/threads/ThreadMarkdownImage", async () => {
112+
const { createContext } = await import("react");
113+
return {
114+
ThreadMarkdownImageView: () => null,
115+
MarkdownImageAssetScopeContext: createContext<string | undefined>(undefined),
116+
};
117+
});
112118

113119
import {
114120
ThreadMarkdownVideo,

0 commit comments

Comments
 (0)