(root: string)
| 26 | // A minimal legacy database: loose `<Name>.csv` + co-located sidecar, with one |
| 27 | // record-page note under the per-database `<Name>/` folder. |
| 28 | async function seedLegacyDatabase(root: string): Promise<void> { |
| 29 | await writeFile(path.join(root, 'inbox', 'Books.csv'), 'id,Title\nr1,Dune\n', 'utf8') |
| 30 | await mkdir(path.join(root, 'inbox', 'Books'), { recursive: true }) |
| 31 | await writeFile(path.join(root, 'inbox', 'Books', 'Dune.md'), '# Dune\n\nGreat book.', 'utf8') |
| 32 | const sidecar = { |
| 33 | version: 1, |
| 34 | idFieldId: 'f_id', |
| 35 | fields: [ |
| 36 | { id: 'f_id', name: 'id', type: 'text', hidden: true }, |
| 37 | { id: 'f_title', name: 'Title', type: 'text' } |
| 38 | ], |
| 39 | views: [{ id: 'v1', name: 'Table', type: 'table', filters: [], sorts: [] }], |
| 40 | activeViewId: 'v1', |
| 41 | pages: { r1: 'inbox/Books/Dune.md' } |
| 42 | } |
| 43 | await writeFile( |
| 44 | path.join(root, 'inbox', 'Books.csv.base.json'), |
| 45 | JSON.stringify(sidecar, null, 2), |
| 46 | 'utf8' |
| 47 | ) |
| 48 | } |
| 49 | |
| 50 | describe('migrateLegacyDatabases (#185 .base reorg)', () => { |
| 51 | it('moves a legacy database into a self-contained .base folder', async () => { |
no outgoing calls
no test coverage detected