MCPcopy Create free account
hub / github.com/callumalpass/tasknotes / createHost

Function createHost

tests/unit/bootstrap/starterNote.test.ts:16–42  ·  view source on GitHub ↗
(options: { shouldCreateStarterNote: boolean; starterNoteCreated?: boolean })

Source from the content-addressed store, hash-verified

14}
15
16function 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
44describe("starter note onboarding", () => {
45 beforeEach(async () => {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected