diff --git a/frontend/src/__tests__/keyboard.test.js b/frontend/src/__tests__/keyboard.test.js index 9dbde81..a67df28 100644 --- a/frontend/src/__tests__/keyboard.test.js +++ b/frontend/src/__tests__/keyboard.test.js @@ -1,24 +1,138 @@ -import { describe, it } from 'vitest' +import { describe, it, expect, vi, beforeEach } from 'vitest' +import { mount, flushPromises } from '@vue/test-utils' +import { setActivePinia, createPinia } from 'pinia' +import { createRouter, createMemoryHistory } from 'vue-router' +import FileManagerView from '../views/FileManagerView.vue' + +vi.mock('../api/client.js', () => ({ + listFolders: vi.fn().mockResolvedValue({ items: [] }), + listDocuments: vi.fn().mockResolvedValue({ items: [], total: 0 }), + getFolder: vi.fn().mockResolvedValue({ id: 'f1', name: 'Test', breadcrumb: [] }), + createFolder: vi.fn(), + renameFolder: vi.fn(), + deleteFolder: vi.fn(), + moveDocument: vi.fn(), + deleteDocument: vi.fn().mockResolvedValue(null), + getSharedWithMe: vi.fn().mockResolvedValue([]), + listTopics: vi.fn().mockResolvedValue([]), + getMyQuota: vi.fn().mockResolvedValue({ used_bytes: 0, limit_bytes: 104857600 }), +})) + +vi.mock('../stores/auth.js', () => ({ + useAuthStore: () => ({ + user: { email: 'test@example.com', role: 'user' }, + accessToken: 'fake-token', + fetchQuota: vi.fn().mockResolvedValue(null), + }), +})) + +vi.mock('../stores/topics.js', () => ({ + useTopicsStore: () => ({ + topics: [], + loading: false, + fetchTopics: vi.fn().mockResolvedValue(null), + }), +})) + +vi.mock('../components/ui/BreadcrumbBar.vue', () => ({ + default: { template: '