2025-09-30 19:31:51 +00:00
/ * *
* @license
* Copyright 2025 Google LLC
* SPDX - License - Identifier : Apache - 2.0
* /
import { expect , describe , it , beforeEach , afterEach } from 'vitest' ;
2025-10-11 08:33:01 -07:00
import { TestRig } from './test-helper.js' ;
2025-09-30 19:31:51 +00:00
2025-10-14 08:16:22 -07:00
describe . skip ( 'Interactive Mode' , ( ) = > {
2025-09-30 19:31:51 +00:00
let rig : TestRig ;
beforeEach ( ( ) = > {
rig = new TestRig ( ) ;
} ) ;
afterEach ( async ( ) = > {
await rig . cleanup ( ) ;
} ) ;
2025-10-09 15:35:52 -07:00
it ( 'should trigger chat compression with /compress command' , async ( ) = > {
2025-10-08 17:29:14 -07:00
await rig . setup ( 'interactive-compress-test' ) ;
2025-10-11 08:33:01 -07:00
const run = await rig . runInteractive ( ) ;
2025-10-08 17:29:14 -07:00
const longPrompt =
'Dont do anything except returning a 1000 token long paragragh with the <name of the scientist who discovered theory of relativity> at the end to indicate end of response. This is a moderately long sentence.' ;
2025-10-11 08:33:01 -07:00
await run . type ( longPrompt ) ;
await run . type ( '\r' ) ;
2025-10-08 17:29:14 -07:00
2025-10-13 11:42:27 -07:00
await run . expectText ( 'einstein' , 25000 ) ;
2025-10-08 17:29:14 -07:00
2025-10-11 08:33:01 -07:00
await run . type ( '/compress' ) ;
2025-10-08 17:29:14 -07:00
// A small delay to allow React to re-render the command list.
await new Promise ( ( resolve ) = > setTimeout ( resolve , 100 ) ) ;
2025-10-11 08:33:01 -07:00
await run . type ( '\r' ) ;
2025-10-08 17:29:14 -07:00
const foundEvent = await rig . waitForTelemetryEvent (
'chat_compression' ,
90000 ,
) ;
expect ( foundEvent , 'chat_compression telemetry event was not found' ) . toBe (
true ,
) ;
} ) ;
//TODO - https://github.com/google-gemini/gemini-cli/issues/10769
it . skip ( 'should handle compression failure on token inflation' , async ( ) = > {
await rig . setup ( 'interactive-compress-test' ) ;
2025-10-11 08:33:01 -07:00
const run = await rig . runInteractive ( ) ;
2025-10-08 17:29:14 -07:00
2025-10-11 08:33:01 -07:00
await run . type ( '/compress' ) ;
2025-10-13 11:42:27 -07:00
// A small delay to allow React to re-render the command list.
2025-10-08 17:29:14 -07:00
await new Promise ( ( resolve ) = > setTimeout ( resolve , 100 ) ) ;
2025-10-11 08:33:01 -07:00
await run . type ( '\r' ) ;
2025-10-13 11:42:27 -07:00
await run . expectText ( 'compression was not beneficial' , 25000 ) ;
2025-10-08 17:29:14 -07:00
} ) ;
2025-09-30 19:31:51 +00:00
} ) ;