Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

test(mobile): 补齐错误卡片共享组件的测试依赖

Dashe0aa3e47498b
diff --git a/apps/mobile/src/__tests__/InlineQueueSection.test.tsx b/apps/mobile/src/__tests__/InlineQueueSection.test.tsx
index bfce26c517..015af69321 100644
--- a/apps/mobile/src/__tests__/InlineQueueSection.test.tsx
+++ b/apps/mobile/src/__tests__/InlineQueueSection.test.tsx
@@ -15,7 +15,7 @@ vi.mock('react-native', async () => {
StyleSheet: { create: (s: unknown) => s, hairlineWidth: 1 } };
});
vi.mock('@/components/AppText', async () => ({ Text: (await import('react-native')).Text }));
-vi.mock('lucide-react-native', () => ({ Pause: () => null, Play: () => null }));
+vi.mock('lucide-react-native', () => ({ Pause: () => null, Play: () => null, CircleAlert: () => null, X: () => null, ChevronRight: () => null, ChevronDown: () => null }));
vi.mock('react-i18next', async (importOriginal) => ({
...await importOriginal<typeof import('react-i18next')>(),
useTranslation: () => ({ t: (key: string) => key }),
diff --git a/apps/mobile/src/__tests__/PiSessionTreeSheet.test.tsx b/apps/mobile/src/__tests__/PiSessionTreeSheet.test.tsx
index 5eba056919..9a2f393eca 100644
--- a/apps/mobile/src/__tests__/PiSessionTreeSheet.test.tsx
+++ b/apps/mobile/src/__tests__/PiSessionTreeSheet.test.tsx
@@ -21,8 +21,11 @@ vi.mock('react-native', async () => {
StyleSheet: { create: (value: unknown) => value, hairlineWidth: 1 },
useWindowDimensions: () => ({ width: 390, height: 844 }) };
});
+vi.mock('@/components/MobilePrimitives', () => ({
+ MainWindowActionButton: ({ action }: any) => <button onClick={action.onPress} disabled={action.disabled || action.busy}>{action.label}</button>,
+}));
vi.mock('@/components/AppText', async () => ({ Text: (await import('react-native')).Text }));
-vi.mock('lucide-react-native', () => ({ Check: () => null, GitBranch: () => null, MessageSquare: () => null }));
+vi.mock('lucide-react-native', () => ({ CircleAlert: () => null, Check: () => null, GitBranch: () => null, MessageSquare: () => null }));
vi.mock('react-native-safe-area-context', () => ({ useSafeAreaInsets: () => ({ top: 0, bottom: 0 }) }));
vi.mock('@/theme', async () => {
const tokens = await import('@/theme/tokens');
diff --git a/apps/mobile/src/__tests__/goalNativeForm.test.tsx b/apps/mobile/src/__tests__/goalNativeForm.test.tsx
index 6e75a7afa2..9b59b3ff7e 100644
--- a/apps/mobile/src/__tests__/goalNativeForm.test.tsx
+++ b/apps/mobile/src/__tests__/goalNativeForm.test.tsx
@@ -4,6 +4,9 @@ import { createRoot } from 'react-dom/client';
import { afterEach, expect, it, vi } from 'vitest';
import { ContextSheetGoalCreateForm, ContextSheetGoalView } from '@/session/ContextSheetGoalView.ios';
+vi.mock('react-native', () => ({ View: ({ children }: any) => createElement('div', null, children) }));
+vi.mock('lucide-react-native', () => ({ CircleAlert: () => null }));
+
const bridge = vi.hoisted(() => ({ props: new Map<string, any>(), mode: 'light' }));
vi.mock('@expo/ui/swift-ui', async () => {
const React = await import('react');
@@ -11,7 +14,7 @@ vi.mock('@expo/ui/swift-ui', async () => {
if (p.testID) bridge.props.set(p.testID, p);
return React.createElement('div', null, p.children);
};
- return { Button: control, DisclosureGroup: control, Picker: control, ProgressView: control, Text: control, TextField: control,
+ return { HStack: control, RNHostView: control, Button: control, DisclosureGroup: control, Picker: control, ProgressView: control, Text: control, TextField: control,
useNativeState: (initial: string) => {
const state = React.useRef({ value: initial, get() { return this.value; }, set(value: string) { this.value = value; } });
return state.current;
@@ -19,7 +22,7 @@ vi.mock('@expo/ui/swift-ui', async () => {
};
});
vi.mock('@expo/ui/swift-ui/modifiers', () => Object.fromEntries(
- ['buttonBorderShape', 'controlSize', 'accessibilityHint', 'accessibilityLabel', 'buttonStyle', 'contentShape', 'disabled', 'font', 'foregroundStyle', 'frame', 'lineLimit', 'pickerStyle', 'tag', 'tint'].map(key => [key, (value: any) => ({ [key]: value })]).concat([['shapes', { rectangle: () => ({}) }] as any]),
+ ['fixedSize', 'buttonBorderShape', 'controlSize', 'accessibilityHint', 'accessibilityLabel', 'buttonStyle', 'contentShape', 'disabled', 'font', 'foregroundStyle', 'frame', 'lineLimit', 'pickerStyle', 'tag', 'tint'].map(key => [key, (value: any) => ({ [key]: value })]).concat([['shapes', { rectangle: () => ({}) }] as any]),
));
vi.mock('@/theme', () => ({ navigationChrome: { target: 44 }, useTheme: () => ({ colors: {
cta: bridge.mode === 'dark' ? 'white' : 'black',
diff --git a/apps/mobile/src/__tests__/nativeGlassControls.test.tsx b/apps/mobile/src/__tests__/nativeGlassControls.test.tsx
index bed81f7607..95f6e93441 100644
--- a/apps/mobile/src/__tests__/nativeGlassControls.test.tsx
+++ b/apps/mobile/src/__tests__/nativeGlassControls.test.tsx
@@ -66,6 +66,7 @@ vi.mock("react-native", () => ({
vi.mock("lucide-react-native", () => {
const Icon = () => null;
return {
+ CircleAlert: Icon,
LogOut: Icon,
Monitor: Icon,
Search: Icon,
diff --git a/apps/mobile/src/__tests__/newTaskSelectionAndroid.test.tsx b/apps/mobile/src/__tests__/newTaskSelectionAndroid.test.tsx
index d5b286be0e..dfc071ac98 100644
--- a/apps/mobile/src/__tests__/newTaskSelectionAndroid.test.tsx
+++ b/apps/mobile/src/__tests__/newTaskSelectionAndroid.test.tsx
@@ -8,6 +8,7 @@ const driveMenu = vi.hoisted(() => ({ props: null as any }));
vi.mock("react-native", () => ({
View: ({ children }: any) => <div>{children}</div>,
ActivityIndicator: () => <span>loading</span>,
+ StyleSheet: { create: (styles: unknown) => styles, hairlineWidth: 1 },
useWindowDimensions: () => ({ width: 400, height: 800 }),
}));
vi.mock("react-native-safe-area-context", () => ({
@@ -25,8 +26,10 @@ vi.mock("@/theme", () => ({
spacing: {},
typeScale: {},
useTheme: () => ({ colors: {} }),
+ useThemedStyles: (make: (colors: object) => unknown) => make({}),
}));
vi.mock("lucide-react-native", () => ({
+ CircleAlert: () => null,
ArrowUp: () => null,
ChevronRight: () => null,
Folder: () => null,