fix(token-meter): reject stale config (round 2)

This commit is contained in:
Hypatia May
2026-07-16 13:23:20 +08:00
parent 5c243e8a8d
commit 19a56ec542
9 changed files with 110 additions and 34 deletions

View File

@@ -81,6 +81,11 @@ describe('TokenMeterService configuration and registration', () => {
expect(meter({ contextWindow: 32_000 }).contextWindow).toBe(32_000)
})
it.each(['models', 'contextWidow'])('rejects unknown top-level config key %s', (key) => {
expect(() => meter({ [key]: {} }))
.toThrow(`TokenMeterConfig: unknown key "${key}"`)
})
it.each([
{ contextWindow: 0 },
{ contextWindow: -1 },