MCPcopy Index your code
hub / github.com/ChatLab/ChatLab / writeTempChatFile

Function writeTempChatFile

apps/cli/src/import/importer.test.ts:33–46  ·  view source on GitHub ↗

Write a minimal valid ChatLab Format JSON to a temp file and return the path.

(dir: string)

Source from the content-addressed store, hash-verified

31
32/** Write a minimal valid ChatLab Format JSON to a temp file and return the path. */
33function 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
48test('streamImport raises the data directory gate after creating a current-schema database', async () => {
49 const root = makeTempDir()

Callers 1

importer.test.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected