Add FolderSelector component and integrate with CreateFileModal

This commit is contained in:
2025-11-11 20:05:27 +01:00
parent c98ece29d9
commit bc49391b5c
4 changed files with 434 additions and 6 deletions

View File

@@ -29,6 +29,31 @@ vi.mock('../../../contexts/ModalContext', () => ({
useModalContext: () => mockModalContext,
}));
// Mock useFileList hook
const mockLoadFileList = vi.fn();
const mockFiles = [
{
id: '1',
name: 'docs',
path: 'docs',
children: [
{
id: '2',
name: 'guides',
path: 'docs/guides',
children: [],
},
],
},
];
vi.mock('../../../hooks/useFileList', () => ({
useFileList: () => ({
files: mockFiles,
loadFileList: mockLoadFileList,
}),
}));
// Helper wrapper component for testing
const TestWrapper = ({ children }: { children: React.ReactNode }) => (
<MantineProvider defaultColorScheme="light">{children}</MantineProvider>
@@ -47,6 +72,8 @@ describe('CreateFileModal', () => {
mockOnCreateFile.mockReset();
mockOnCreateFile.mockResolvedValue(undefined);
mockModalContext.setNewFileModalVisible.mockClear();
mockLoadFileList.mockClear();
mockLoadFileList.mockResolvedValue(undefined);
});
describe('Modal Visibility and Content', () => {