MCPcopy
hub / github.com/callumalpass/tasknotes / createPlugin

Function createPlugin

tests/unit/ui/taskCardMetadata.test.ts:19–53  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

17}
18
19function createPlugin(): TaskNotesPlugin {
20 return {
21 settings: {},
22 app: {
23 metadataCache: {
24 getFirstLinkpathDest: jest.fn(() => null),
25 getCache: jest.fn(() => ({ frontmatter: {} })),
26 },
27 vault: {
28 getAbstractFileByPath: jest.fn(() => null),
29 },
30 workspace: {
31 openLinkText: jest.fn(),
32 },
33 },
34 fieldMapper: {
35 isPropertyForField: jest.fn(() => false),
36 lookupMappingKey: jest.fn((propertyId: string) => propertyId),
37 toUserField: jest.fn((field: string) => field),
38 },
39 i18n: {
40 translate: jest.fn((key: string) => {
41 const translations: Record<string, string> = {
42 "ui.taskCard.blockedBadge": "Blocked",
43 "ui.taskCard.blockedBadgeTooltip": "This task is blocked",
44 "ui.taskCard.blockingBadge": "Blocking",
45 "ui.taskCard.blockingBadgeTooltip": "This task is blocking another task",
46 "ui.taskCard.googleCalendarSyncTooltip": "Synced to Google Calendar",
47 "ui.taskCard.labels.due": "Due",
48 };
49 return translations[key] ?? key;
50 }),
51 },
52 } as unknown as TaskNotesPlugin;
53}
54
55function createMetadataHost() {
56 const card = document.createElement("div");

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected