| 14 | } |
| 15 | |
| 16 | function createHost(options: { shouldCreateStarterNote: boolean; starterNoteCreated?: boolean }) { |
| 17 | const app = new App(); |
| 18 | const openFile = jest.fn().mockResolvedValue(undefined); |
| 19 | (app.workspace as unknown as { getLeaf: jest.Mock }).getLeaf = jest.fn(() => ({ openFile })); |
| 20 | |
| 21 | const settings = { |
| 22 | starterNoteCreated: options.starterNoteCreated ?? false, |
| 23 | }; |
| 24 | |
| 25 | const saveSettings = jest.fn().mockResolvedValue(undefined); |
| 26 | const warn = jest.fn(); |
| 27 | |
| 28 | return { |
| 29 | app, |
| 30 | openFile, |
| 31 | saveSettings, |
| 32 | settings, |
| 33 | warn, |
| 34 | host: { |
| 35 | app, |
| 36 | settings, |
| 37 | shouldCreateStarterNote: options.shouldCreateStarterNote, |
| 38 | saveSettings, |
| 39 | warn, |
| 40 | }, |
| 41 | }; |
| 42 | } |
| 43 | |
| 44 | describe("starter note onboarding", () => { |
| 45 | beforeEach(async () => { |