44 normalizeModel ,
55 filterInput ,
66 getReasoningConfig ,
7+ transformRequestBody ,
78} from "../../lib/request/request-transformer.js" ;
8- import type { InputItem } from "../../lib/types.js" ;
9+ import type { InputItem , RequestBody } from "../../lib/types.js" ;
910import { arbModel , arbMessageRole } from "./helpers.js" ;
1011
1112describe ( "normalizeModel property tests" , ( ) => {
@@ -216,44 +217,43 @@ describe("getReasoningConfig property tests", () => {
216217 ) ;
217218 } ) ;
218219
219- it ( "codex models upgrade none to low" , ( ) => {
220- fc . assert (
221- fc . property (
222- fc . constantFrom (
223- "gpt-5.1-codex" ,
224- "gpt-5.2-codex" ,
225- "gpt-5.3-codex" ,
226- "gpt-5.1-codex-max" ,
227- ) ,
228- ( model ) => {
229- const result = getReasoningConfig ( model , { reasoningEffort : "none" } ) ;
230- expect ( result . effort ) . toBe ( "low" ) ;
220+ it ( "codex models upgrade none to low" , ( ) => {
221+ fc . assert (
222+ fc . property (
223+ fc . constantFrom (
224+ "gpt-5.1-codex" ,
225+ "gpt-5.2-codex" ,
226+ "gpt-5.3-codex" ,
227+ "gpt-5.1-codex-max" ,
228+ ) ,
229+ ( model ) => {
230+ const result = getReasoningConfig ( model , { reasoningEffort : "none" } ) ;
231+ expect ( result . effort ) . toBe ( "low" ) ;
231232 return true ;
232233 }
233234 )
234235 ) ;
235236 } ) ;
236237
237- it ( "gpt-5.4-pro upgrades none to medium (none→low→medium chain)" , ( ) => {
238- fc . assert (
239- fc . property ( fc . constant ( "gpt-5.4-pro" ) , ( model ) => {
240- const result = getReasoningConfig ( model , { reasoningEffort : "none" } ) ;
241- expect ( result . effort ) . toBe ( "medium" ) ;
242- return true ;
243- } )
244- ) ;
238+ it ( "gpt-5.4-pro upgrades none to medium (none→low→medium chain)" , ( ) => {
239+ fc . assert (
240+ fc . property ( fc . constant ( "gpt-5.4-pro" ) , ( model ) => {
241+ const result = getReasoningConfig ( model , { reasoningEffort : "none" } ) ;
242+ expect ( result . effort ) . toBe ( "medium" ) ;
243+ return true ;
244+ } )
245+ ) ;
245246 } ) ;
246247
247- it ( "gpt-5.4-pro upgrades minimal to medium" , ( ) => {
248- fc . assert (
249- fc . property ( fc . constant ( "gpt-5.4-pro" ) , ( model ) => {
250- const result = getReasoningConfig ( model , { reasoningEffort : "minimal" } ) ;
251- expect ( result . effort ) . toBe ( "medium" ) ;
252- return true ;
253- } )
254- ) ;
255- } ) ;
256-
248+ it ( "gpt-5.4-pro upgrades minimal to medium" , ( ) => {
249+ fc . assert (
250+ fc . property ( fc . constant ( "gpt-5.4-pro" ) , ( model ) => {
251+ const result = getReasoningConfig ( model , { reasoningEffort : "minimal" } ) ;
252+ expect ( result . effort ) . toBe ( "medium" ) ;
253+ return true ;
254+ } )
255+ ) ;
256+ } ) ;
257257 it ( "gpt-5.1, gpt-5.2, and gpt-5.4 general support none effort" , ( ) => {
258258 fc . assert (
259259 fc . property (
@@ -273,3 +273,25 @@ describe("getReasoningConfig property tests", () => {
273273 expect ( result . summary ) . toBeDefined ( ) ;
274274 } ) ;
275275} ) ;
276+
277+ describe ( "transformRequestBody property tests" , ( ) => {
278+ it ( "preserves max_output_tokens across arbitrary positive integers" , async ( ) => {
279+ await fc . assert (
280+ fc . asyncProperty (
281+ fc . constantFrom ( "gpt-5" , "gpt-5.4-pro" , "gpt-5.1-codex" ) ,
282+ fc . integer ( { min : 1 , max : 1_000_000 } ) ,
283+ async ( model , maxOutputTokens ) => {
284+ const body : RequestBody = {
285+ model,
286+ input : [ ] ,
287+ max_output_tokens : maxOutputTokens ,
288+ } ;
289+
290+ const result = await transformRequestBody ( body , "Test Codex Instructions" ) ;
291+ expect ( result . max_output_tokens ) . toBe ( maxOutputTokens ) ;
292+ expect ( result . max_completion_tokens ) . toBeUndefined ( ) ;
293+ return true ;
294+ } )
295+ ) ;
296+ } ) ;
297+ } ) ;
0 commit comments