@@ -309,23 +309,33 @@ describe('ChatRecordingService', () => {
309309 } ) ;
310310
311311 describe ( 'deleteSession' , ( ) => {
312- it ( 'should delete the session file and tool outputs if they exist' , ( ) => {
312+ it ( 'should delete the session file, tool outputs, session directory, and logs if they exist' , ( ) => {
313+ const sessionId = 'test-session-id' ;
313314 const chatsDir = path . join ( testTempDir , 'chats' ) ;
315+ const logsDir = path . join ( testTempDir , 'logs' ) ;
316+ const toolOutputsDir = path . join ( testTempDir , 'tool-outputs' ) ;
317+ const sessionDir = path . join ( testTempDir , sessionId ) ;
318+
314319 fs . mkdirSync ( chatsDir , { recursive : true } ) ;
315- const sessionFile = path . join ( chatsDir , 'test-session-id.json' ) ;
320+ fs . mkdirSync ( logsDir , { recursive : true } ) ;
321+ fs . mkdirSync ( toolOutputsDir , { recursive : true } ) ;
322+ fs . mkdirSync ( sessionDir , { recursive : true } ) ;
323+
324+ const sessionFile = path . join ( chatsDir , `${ sessionId } .json` ) ;
316325 fs . writeFileSync ( sessionFile , '{}' ) ;
317326
318- const toolOutputDir = path . join (
319- testTempDir ,
320- 'tool-outputs' ,
321- 'session-test-session-id' ,
322- ) ;
327+ const logFile = path . join ( logsDir , `session-${ sessionId } .jsonl` ) ;
328+ fs . writeFileSync ( logFile , '{}' ) ;
329+
330+ const toolOutputDir = path . join ( toolOutputsDir , `session-${ sessionId } ` ) ;
323331 fs . mkdirSync ( toolOutputDir , { recursive : true } ) ;
324332
325- chatRecordingService . deleteSession ( 'test-session-id' ) ;
333+ chatRecordingService . deleteSession ( sessionId ) ;
326334
327335 expect ( fs . existsSync ( sessionFile ) ) . toBe ( false ) ;
336+ expect ( fs . existsSync ( logFile ) ) . toBe ( false ) ;
328337 expect ( fs . existsSync ( toolOutputDir ) ) . toBe ( false ) ;
338+ expect ( fs . existsSync ( sessionDir ) ) . toBe ( false ) ;
329339 } ) ;
330340
331341 it ( 'should not throw if session file does not exist' , ( ) => {
0 commit comments