(page: Page)
| 137 | } |
| 138 | |
| 139 | async function readTaskDates(page: Page): Promise<TaskDates> { |
| 140 | return page.evaluate(async (targetPath) => { |
| 141 | const obsidianApp = (window as any).app; |
| 142 | const file = obsidianApp?.vault?.getAbstractFileByPath?.(targetPath); |
| 143 | if (!file) { |
| 144 | throw new Error(`Could not read ${targetPath}`); |
| 145 | } |
| 146 | const content: string = await obsidianApp.vault.read(file); |
| 147 | const scheduled = content.match(/^scheduled:\s*(.+)$/m)?.[1]?.trim(); |
| 148 | const due = content.match(/^due:\s*(.+)$/m)?.[1]?.trim(); |
| 149 | if (!scheduled || !due) { |
| 150 | throw new Error(`Task dates missing in ${targetPath}`); |
| 151 | } |
| 152 | return { scheduled, due }; |
| 153 | }, SPAN_TASK_RELATIVE_PATH); |
| 154 | } |
| 155 | |
| 156 | function eventsForTask(page: Page, eventType: string): Locator { |
| 157 | return page |
no test coverage detected