(savedNotesRoute?: string)
| 1 | import { beforeEach, describe, expect, it, vi } from 'vitest' |
| 2 | |
| 3 | async function loadSpaceDefinitions(savedNotesRoute?: string) { |
| 4 | vi.resetModules() |
| 5 | |
| 6 | vi.doMock('@/electron', () => ({ |
| 7 | i18n: { |
| 8 | t: (value: string) => value, |
| 9 | }, |
| 10 | store: { |
| 11 | app: { |
| 12 | get: vi.fn((key: string) => { |
| 13 | if (key === 'notes.route') { |
| 14 | return savedNotesRoute |
| 15 | } |
| 16 | |
| 17 | return undefined |
| 18 | }), |
| 19 | }, |
| 20 | }, |
| 21 | })) |
| 22 | |
| 23 | vi.doMock('@/router', () => ({ |
| 24 | RouterName: { |
| 25 | main: 'main', |
| 26 | notesSpace: 'notes-space', |
| 27 | notesDashboard: 'notes-space/dashboard', |
| 28 | notesGraph: 'notes-space/graph', |
| 29 | mathNotebook: 'math-notebook', |
| 30 | devtools: 'devtools', |
| 31 | }, |
| 32 | router: { |
| 33 | currentRoute: { |
| 34 | value: { |
| 35 | name: null, |
| 36 | }, |
| 37 | }, |
| 38 | }, |
| 39 | })) |
| 40 | |
| 41 | return import('../spaceDefinitions') |
| 42 | } |
| 43 | |
| 44 | beforeEach(() => { |
| 45 | vi.clearAllMocks() |
no outgoing calls
no test coverage detected