summaryrefslogtreecommitdiff
path: root/packages/cli/src/config/config.test.ts
diff options
context:
space:
mode:
authorJacob MacDonald <[email protected]>2025-08-07 07:34:40 -0700
committerGitHub <[email protected]>2025-08-07 14:34:40 +0000
commit6ae75c9f32a968efa50857a8f24b958a58a84fd6 (patch)
tree6daccaf6fba4ac462a19ed75e198c02840f6a1a3 /packages/cli/src/config/config.test.ts
parent36750ca49b1b2fa43a3d7904416b876203a1850f (diff)
Add a context percentage threshold setting for auto compression (#5721)
Diffstat (limited to 'packages/cli/src/config/config.test.ts')
-rw-r--r--packages/cli/src/config/config.test.ts39
1 files changed, 39 insertions, 0 deletions
diff --git a/packages/cli/src/config/config.test.ts b/packages/cli/src/config/config.test.ts
index 6a7e3b57..b670fbc8 100644
--- a/packages/cli/src/config/config.test.ts
+++ b/packages/cli/src/config/config.test.ts
@@ -1123,3 +1123,42 @@ describe('loadCliConfig with includeDirectories', () => {
);
});
});
+
+describe('loadCliConfig chatCompression', () => {
+ const originalArgv = process.argv;
+ const originalEnv = { ...process.env };
+
+ beforeEach(() => {
+ vi.resetAllMocks();
+ vi.mocked(os.homedir).mockReturnValue('/mock/home/user');
+ process.env.GEMINI_API_KEY = 'test-api-key';
+ });
+
+ afterEach(() => {
+ process.argv = originalArgv;
+ process.env = originalEnv;
+ vi.restoreAllMocks();
+ });
+
+ it('should pass chatCompression settings to the core config', async () => {
+ process.argv = ['node', 'script.js'];
+ const argv = await parseArguments();
+ const settings: Settings = {
+ chatCompression: {
+ contextPercentageThreshold: 0.5,
+ },
+ };
+ const config = await loadCliConfig(settings, [], 'test-session', argv);
+ expect(config.getChatCompression()).toEqual({
+ contextPercentageThreshold: 0.5,
+ });
+ });
+
+ it('should have undefined chatCompression if not in settings', async () => {
+ process.argv = ['node', 'script.js'];
+ const argv = await parseArguments();
+ const settings: Settings = {};
+ const config = await loadCliConfig(settings, [], 'test-session', argv);
+ expect(config.getChatCompression()).toBeUndefined();
+ });
+});