| 22 | import { deleteChatSession, getAllChats } from '../chat-history' |
| 23 | |
| 24 | function writeChat(chatId: string, prompt: string) { |
| 25 | const chatDir = path.join(tempDataDir, 'chats', chatId) |
| 26 | fs.mkdirSync(chatDir, { recursive: true }) |
| 27 | fs.writeFileSync( |
| 28 | path.join(chatDir, 'chat-messages.json'), |
| 29 | JSON.stringify([ |
| 30 | { |
| 31 | id: `${chatId}-message`, |
| 32 | variant: 'user', |
| 33 | content: prompt, |
| 34 | timestamp: new Date().toISOString(), |
| 35 | blocks: [], |
| 36 | }, |
| 37 | ]), |
| 38 | ) |
| 39 | } |
| 40 | |
| 41 | describe('chat-history', () => { |
| 42 | beforeEach(() => { |