()
| 17 | } |
| 18 | |
| 19 | function 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 | |
| 55 | function createMetadataHost() { |
| 56 | const card = document.createElement("div"); |
no outgoing calls
no test coverage detected