Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。
TypeScript agentai-agentai-assistantandroidclaude-codecodexelectroniosllmmacosreact-nativetypescriptwindows
test(mobile): isolate webview across attachment renderer suites
Chris84cc80e2abe9
diff --git a/apps/mobile/src/__tests__/BotGroupMessageAttachments.test.tsx b/apps/mobile/src/__tests__/BotGroupMessageAttachments.test.tsxindex 2d1de91cc5..eb32a9ca3c 100644--- a/apps/mobile/src/__tests__/BotGroupMessageAttachments.test.tsx+++ b/apps/mobile/src/__tests__/BotGroupMessageAttachments.test.tsx@@ -5,6 +5,9 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';import type { ResolveRemoteMediaFn } from '@/session/remoteMedia';import { openBrowserAsync } from 'expo-web-browser';+// The shared renderer imports site-video; replace only its native surface.+vi.mock('react-native-webview', () => ({ WebView: () => null }));+// Keep the real group attachment, AttachmentStrip, MediaPreview and LegendList hooks.// Only native surfaces and unrelated viewers are replaced for Node rendering.const imageEvents = vi.hoisted(() => new Map<string, { onLoad: (event: unknown) => void; onError: () => void; onDisplay: () => void; transition: number }>());diff --git a/apps/mobile/src/__tests__/botGroupAttachmentLightbox.test.tsx b/apps/mobile/src/__tests__/botGroupAttachmentLightbox.test.tsxindex 334fd51f7f..2b5a45f2f3 100644--- a/apps/mobile/src/__tests__/botGroupAttachmentLightbox.test.tsx+++ b/apps/mobile/src/__tests__/botGroupAttachmentLightbox.test.tsx@@ -7,6 +7,8 @@ import type { ResolveRemoteMediaFn } from '@/session/remoteMedia';// This suite exercises attachments; MCP App's native WebView is covered by mcpAppCard.test.tsx.vi.mock('@/session/McpAppCard', () => ({ McpAppCard: () => null }));+// The shared message renderer also imports the site-video native surface.+vi.mock('react-native-webview', () => ({ WebView: () => null }));// Group attachments open the real shared ImageLightbox here (#5875): the timeline strip, the payload// conversion and the viewer are production code; only native surfaces and unrelated views are replaced.diff --git a/apps/mobile/src/__tests__/fileChipNameWidth.test.tsx b/apps/mobile/src/__tests__/fileChipNameWidth.test.tsxindex 2951fac983..57e66fafba 100644--- a/apps/mobile/src/__tests__/fileChipNameWidth.test.tsx+++ b/apps/mobile/src/__tests__/fileChipNameWidth.test.tsx@@ -7,6 +7,7 @@ import type { ResolveRemoteMediaFn } from '@/session/remoteMedia';// This suite exercises attachment layout; keep the unrelated native App surface out of Node.vi.mock('@/session/McpAppCard', () => ({ McpAppCard: () => null }));+vi.mock('react-native-webview', () => ({ WebView: () => null }));// Keeps the rendered React Native styles of the real file chip (#5875). Node has no Yoga, so the// content-sized width below applies Yoga's own flex-basis rule to those styles instead of a layout pass.diff --git a/apps/mobile/src/__tests__/pluginAttachmentBubble.test.tsx b/apps/mobile/src/__tests__/pluginAttachmentBubble.test.tsxindex b70ac4b116..9a8845a269 100644--- a/apps/mobile/src/__tests__/pluginAttachmentBubble.test.tsx+++ b/apps/mobile/src/__tests__/pluginAttachmentBubble.test.tsx@@ -5,6 +5,9 @@ import { describe, expect, it, vi } from 'vitest';const viewportHarness = vi.hoisted(() => ({ list: null as any, finishReveal: null as any, renders: 0, expanded: false }));+// Keep site-video's native surface out of this Node message-rendering test.+vi.mock('react-native-webview', () => ({ WebView: () => null }));+// Keep the production list, bubble gate, invocation header, and message model.// Only native surfaces and unrelated heavy viewers are replaced for Node rendering.vi.mock('react-native', async () => {