MCPcopy
hub / github.com/afar1/fieldtheory-cli / withIsolatedDataDir

Function withIsolatedDataDir

tests/md-export.test.ts:9–22  ·  view source on GitHub ↗
(fn: (dir: string) => Promise<void>, fixtures: any[])

Source from the content-addressed store, hash-verified

7import { exportBookmarks } from '../src/md-export.js';
8
9async 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
24test('exportBookmarks: writes ISO dates for legacy postedAt in filenames and frontmatter', async () => {
25 const fixtures = [

Callers 1

md-export.test.tsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected