@@ -3,6 +3,8 @@ import assert from 'node:assert/strict';
33
44import {
55 buildSessionAnalysisInput ,
6+ filterSessionManagementProjects ,
7+ filterSessionManagementSessions ,
68 formatProviderSummary ,
79 getRoleSummaryLabel ,
810 mapSessionAnalysisResultResponse ,
@@ -82,6 +84,45 @@ test('sessions panel uses compact metadata only when row width is constrained',
8284 assert . equal ( shouldUseCompactSessionMetadata ( 0 ) , false ) ;
8385} ) ;
8486
87+ test ( 'session management search matches project names case-insensitively' , ( ) => {
88+ const [ project ] = createProviderMergeSnapshotFixture ( ) . projects ;
89+
90+ assert . deepEqual (
91+ filterSessionManagementProjects ( [ project ] , 'gettokens' ) . map ( ( item ) => item . id ) ,
92+ [ 'gettokens' ] ,
93+ ) ;
94+ assert . deepEqual (
95+ filterSessionManagementSessions ( project , 'gettokens' ) . map ( ( session ) => session . id ) ,
96+ [ 'sessions/2026/04/30/rollout-2026-04-30T23-40-00-gemini.jsonl' ] ,
97+ ) ;
98+ } ) ;
99+
100+ test ( 'session management search matches session ids and file labels case-insensitively' , ( ) => {
101+ const [ project ] = createProviderMergeSnapshotFixture ( ) . projects ;
102+ const sessionID = '019e689a-2f07-7771-ba6e-840b63e5cd69' ;
103+ const projectWithSessionID = {
104+ ...project ,
105+ sessions : [
106+ {
107+ ...project . sessions [ 0 ] ,
108+ id : `projects/gettokens/sessions/${ sessionID } .jsonl` ,
109+ fileLabel : `${ sessionID . toUpperCase ( ) } .jsonl` ,
110+ title : 'unrelated title' ,
111+ summary : 'unrelated summary' ,
112+ } ,
113+ ] ,
114+ } ;
115+
116+ assert . deepEqual (
117+ filterSessionManagementProjects ( [ projectWithSessionID ] , sessionID ) . map ( ( item ) => item . id ) ,
118+ [ 'gettokens' ] ,
119+ ) ;
120+ assert . deepEqual (
121+ filterSessionManagementSessions ( projectWithSessionID , sessionID ) . map ( ( session ) => session . id ) ,
122+ [ `projects/gettokens/sessions/${ sessionID } .jsonl` ] ,
123+ ) ;
124+ } ) ;
125+
85126test ( 'formatSessionMetadataDate keeps current year compact and older years explicit' , ( ) => {
86127 const now = new Date ( 2026 , 4 , 15 ) ;
87128
0 commit comments