import { describe, expect, it } from 'vitest' import { Config } from '../src/config.ts' describe('reasoning schema boundary', () => { const configWith = (model: Record): (() => unknown) => () => Config({ providers: { 'acme-gateway': { api: 'openai-completions', baseURL: 'https://acme.test', models: [{ id: 'm', ...model }], }, }, }) it('rejects a level pi-ai does not know at the write that produced it', () => { expect(configWith({ reasoningEfforts: { ultra: 'x' } })).toThrow(/"off"/) expect(configWith({ reasoningEfforts: { high: 42 } })).toThrow() }) it('keeps false distinguishable from an absent declaration', () => { type Materialized = { providers: Record } const withFalse = configWith({ reasoningEfforts: false })() as Materialized expect(withFalse.providers['acme-gateway']?.models?.[0]?.reasoningEfforts).toBe(false) const absent = configWith({})() as Materialized expect(absent.providers['acme-gateway']?.models?.[0]?.reasoningEfforts).toBeUndefined() }) it('rejects a thinking format outside the offered set', () => { expect(configWith({ compat: { thinkingFormat: 'quantum' } })).toThrow(/expected/) }) })