test: fix 5 failing tests after react-day-picker addition (#101)
PR #98 added react-day-picker via shadcn/ui Calendar but the package was not yet installed in node_modules. This broke 5 test files at import resolution time: - src/App.test.tsx - src/components/Editor.test.tsx - src/components/Inspector.test.tsx - src/components/InspectorPanels.test.tsx - src/components/DynamicPropertiesPanel.test.tsx Fix: add a vitest mock for react-day-picker in the global test setup (same pattern as the existing react-virtuoso mock). DayPicker renders a real calendar widget that requires DOM APIs unavailable in jsdom — mocking it to null is the correct approach for unit/integration tests that don't test date-picker behavior specifically. Before: 5 failed | 48 passed (764 tests) After: 0 failed | 53 passed (929 tests)
This commit is contained in:
@@ -10,6 +10,12 @@ vi.mock('@tauri-apps/plugin-opener', () => ({
|
||||
openUrl: vi.fn(),
|
||||
}))
|
||||
|
||||
// Mock react-day-picker: Calendar component uses DayPicker which needs real DOM APIs not available in jsdom
|
||||
vi.mock('react-day-picker', () => ({
|
||||
DayPicker: () => null,
|
||||
getDefaultClassNames: () => ({}),
|
||||
}))
|
||||
|
||||
// Mock react-virtuoso: JSDOM has no real viewport, so render all items directly
|
||||
vi.mock('react-virtuoso', () => ({
|
||||
Virtuoso: ({ data, itemContent, components }: {
|
||||
|
||||
Reference in New Issue
Block a user