| import { describe, expect, test } from 'bun:test' |
| import { |
| getEffectiveContextWindowSize, |
| getAutoCompactThreshold, |
| } from './autoCompact.ts' |
|
|
| describe('getEffectiveContextWindowSize', () => { |
| test('returns positive value for known models with large context windows', () => { |
| |
| const effective = getEffectiveContextWindowSize('claude-sonnet-4') |
| expect(effective).toBeGreaterThan(0) |
| }) |
|
|
| test('never returns negative even for unknown 3P models (issue #635)', () => { |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| process.env.CLAUDE_CODE_USE_OPENAI = '1' |
| try { |
| const effective = getEffectiveContextWindowSize('some-unknown-3p-model') |
| expect(effective).toBeGreaterThan(0) |
| |
| |
| |
| expect(effective).toBeGreaterThanOrEqual(21_000) |
| } finally { |
| delete process.env.CLAUDE_CODE_USE_OPENAI |
| } |
| }) |
| }) |
|
|
| describe('getAutoCompactThreshold', () => { |
| test('returns positive threshold for known models', () => { |
| const threshold = getAutoCompactThreshold('claude-sonnet-4') |
| expect(threshold).toBeGreaterThan(0) |
| }) |
|
|
| test('never returns negative threshold even for unknown 3P models (issue #635)', () => { |
| process.env.CLAUDE_CODE_USE_OPENAI = '1' |
| try { |
| const threshold = getAutoCompactThreshold('some-unknown-3p-model') |
| expect(threshold).toBeGreaterThan(0) |
| } finally { |
| delete process.env.CLAUDE_CODE_USE_OPENAI |
| } |
| }) |
| }) |