| 7 | import { exportBookmarks } from '../src/md-export.js'; |
| 8 | |
| 9 | async function withIsolatedDataDir(fn: (dir: string) => Promise<void>, fixtures: any[]): Promise<void> { |
| 10 | const dir = await mkdtemp(path.join(tmpdir(), 'ft-md-export-')); |
| 11 | const jsonl = fixtures.map((r) => JSON.stringify(r)).join('\n') + '\n'; |
| 12 | await writeFile(path.join(dir, 'bookmarks.jsonl'), jsonl); |
| 13 | |
| 14 | const saved = process.env.FT_DATA_DIR; |
| 15 | process.env.FT_DATA_DIR = dir; |
| 16 | try { |
| 17 | await fn(dir); |
| 18 | } finally { |
| 19 | if (saved !== undefined) process.env.FT_DATA_DIR = saved; |
| 20 | else delete process.env.FT_DATA_DIR; |
| 21 | } |
| 22 | } |
| 23 | |
| 24 | test('exportBookmarks: writes ISO dates for legacy postedAt in filenames and frontmatter', async () => { |
| 25 | const fixtures = [ |