Files
aiturk-hermes-ide/apps/desktop/electron/compression-settings.test.ts
T
yilsem 91ecad8e5c
Server CI and Windows package / verify (push) Successful in 4m47s
Server CI and Windows package / windows-package (push) Successful in 8m47s
Preserve native Codex history and add configurable cross-model compression
Separate encrypted reasoning from actual compaction, stop migration after native return, and retain full history and recent exchanges. Add typed settings, Gemini fallback, verified provider windows, bounded summaries and durable concurrent checkpoints.

Validation: 245 bridge tests plus focused concurrency tests; 71 settings/connection tests; 66 supplementary tests; TypeScript checks; renderer and Electron bundles; real primary/native/fallback summary probes and 700K input acceptance.
2026-10-13 03:36:42 +03:00

32 lines
1.2 KiB
TypeScript

import fs from 'node:fs'
import os from 'node:os'
import path from 'node:path'
import { afterEach, expect, it } from 'vitest'
import { createCompressionStore } from './compression-settings'
const dirs: string[] = []
afterEach(() => { for (const dir of dirs.splice(0)) fs.rmSync(dir, { recursive: true, force: true }) })
it('persists complete settings and survives reopening', () => {
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'compression-store-'))
dirs.push(dir)
const store = createCompressionStore(dir)
const settings = { ...store.get(), keepTurns: 12, primaryModel: 'ide/primary', fallbackModel: 'ide/backup' }
store.save(settings)
expect(createCompressionStore(dir).get()).toEqual(settings)
expect(fs.readdirSync(dir)).toEqual(['compression-settings.json'])
})
it('rejects invalid thresholds without replacing saved settings', () => {
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'compression-store-'))
dirs.push(dir)
const store = createCompressionStore(dir)
const original = store.save(store.get())
for (const patch of [{ keepTurns: 0 }, { targetPercent: 70 }, { maxTokens: NaN }, { autoEnabled: 'yes' }]) {
expect(() => store.save({ ...original, ...patch })).toThrow()
expect(store.get()).toEqual(original)
}
})