File tree Expand file tree Collapse file tree 2 files changed +9
-8
lines changed
Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -375,21 +375,18 @@ public async Task Should_List_Sessions_With_Context()
375375 var session = await Client . CreateSessionAsync ( ) ;
376376 await session . SendAndWaitAsync ( new MessageOptions { Prompt = "Say hello" } ) ;
377377
378- await Task . Delay ( 200 ) ;
378+ await Task . Delay ( 500 ) ;
379379
380380 var sessions = await Client . ListSessionsAsync ( ) ;
381381 Assert . NotEmpty ( sessions ) ;
382382
383383 var ourSession = sessions . Find ( s => s . SessionId == session . SessionId ) ;
384384 Assert . NotNull ( ourSession ) ;
385385
386- // Verify context field
387- foreach ( var s in sessions )
386+ // Context may be present on sessions that have been persisted with workspace.yaml
387+ if ( ourSession . Context != null )
388388 {
389- if ( s . Context != null )
390- {
391- Assert . False ( string . IsNullOrEmpty ( s . Context . Cwd ) , "Expected context.Cwd to be non-empty when context is present" ) ;
392- }
389+ Assert . False ( string . IsNullOrEmpty ( ourSession . Context . Cwd ) , "Expected context.Cwd to be non-empty when context is present" ) ;
393390 }
394391 }
395392
Original file line number Diff line number Diff line change @@ -23,9 +23,13 @@ describe("Sessions", async () => {
2323 } ) ;
2424
2525 it ( "should list sessions with context field" , async ( ) => {
26- // Create a new session
26+ // Create a new session and send a message to persist it
2727 const session = await client . createSession ( ) ;
2828 expect ( session . sessionId ) . toMatch ( / ^ [ a - f 0 - 9 - ] + $ / ) ;
29+ await session . sendAndWait ( { prompt : "Say hello" } ) ;
30+
31+ // Small delay to ensure session file is written to disk
32+ await new Promise ( ( resolve ) => setTimeout ( resolve , 200 ) ) ;
2933
3034 // List sessions and find the one we just created
3135 const sessions = await client . listSessions ( ) ;
You can’t perform that action at this time.
0 commit comments