Write a minimal valid ChatLab Format JSON to a temp file and return the path.
(dir: string)
| 31 | |
| 32 | /** Write a minimal valid ChatLab Format JSON to a temp file and return the path. */ |
| 33 | function writeTempChatFile(dir: string): string { |
| 34 | const filePath = path.join(dir, 'test-chat.json') |
| 35 | fs.writeFileSync( |
| 36 | filePath, |
| 37 | JSON.stringify({ |
| 38 | chatlab: { version: '0.0.2', exportedAt: 1711468800 }, |
| 39 | meta: { name: 'Test Chat', platform: 'qq', type: 'group' }, |
| 40 | members: [{ platformId: 'u1', accountName: 'Alice' }], |
| 41 | // accountName is required by streaming-importer (skipped otherwise) |
| 42 | messages: [{ sender: 'u1', accountName: 'Alice', timestamp: 1711468800, type: 0, content: 'hello' }], |
| 43 | }) |
| 44 | ) |
| 45 | return filePath |
| 46 | } |
| 47 | |
| 48 | test('streamImport raises the data directory gate after creating a current-schema database', async () => { |
| 49 | const root = makeTempDir() |