@@ -305,23 +305,33 @@ describe('Oracle Fusion Financials provider', () => {
305305 } )
306306
307307 it ( 'stops after two retries and surfaces a sanitized Oracle error' , async ( ) => {
308+ const accessToken = 'short/lived+access~token='
309+ const encodedAccessToken = encodeURIComponent ( accessToken )
310+ const formEncodedAccessToken = new URLSearchParams ( { value : accessToken } )
311+ . toString ( )
312+ . slice ( 'value=' . length )
308313 mockSecureFetch
309314 . mockResolvedValueOnce ( response ( 504 , { title : 'gateway timeout' } ) )
310315 . mockResolvedValueOnce ( response ( 503 , { title : 'unavailable' } ) )
311316 . mockResolvedValueOnce (
312317 response ( 429 , {
313- title : `Token ${ AUTH . accessToken } ` ,
314- detail : 'Request temporarily throttled' ,
318+ title : `Token ${ encodedAccessToken } ` ,
319+ detail : `Token ${ formEncodedAccessToken } ` ,
320+ message : 'access_token=provider-detail-canary&scope=read' ,
315321 } )
316322 )
317323
318- const error = await requestOracleFusionJson ( AUTH , {
319- path : '/fscmRestApi/resources/11.13.18.05/invoices' ,
320- } ) . catch ( ( caught ) => caught )
324+ const error = await requestOracleFusionJson (
325+ { ...AUTH , accessToken } ,
326+ { path : '/fscmRestApi/resources/11.13.18.05/invoices' }
327+ ) . catch ( ( caught ) => caught )
321328 expect ( error ) . toBeInstanceOf ( OracleFusionFinancialsProviderError )
322329 expect ( error ) . toMatchObject ( { status : 429 } )
323330 expect ( ( error as Error ) . message ) . toContain ( '[REDACTED]' )
324- expect ( ( error as Error ) . message ) . not . toContain ( AUTH . accessToken )
331+ expect ( ( error as Error ) . message ) . not . toContain ( accessToken )
332+ expect ( ( error as Error ) . message ) . not . toContain ( encodedAccessToken )
333+ expect ( ( error as Error ) . message ) . not . toContain ( formEncodedAccessToken )
334+ expect ( ( error as Error ) . message ) . not . toContain ( 'provider-detail-canary' )
325335 expect ( mockSecureFetch ) . toHaveBeenCalledTimes ( 3 )
326336 } )
327337
@@ -353,6 +363,7 @@ describe('Oracle Fusion Financials provider', () => {
353363
354364 it ( 'rejects malformed Oracle list envelopes and projected field types' , async ( ) => {
355365 mockSecureFetch
366+ . mockResolvedValueOnce ( response ( 200 , { count : 0 , hasMore : false , limit : 50 , offset : 0 } ) )
356367 . mockResolvedValueOnce (
357368 response ( 200 , { items : [ ] , count : '0' , hasMore : false , limit : 50 , offset : 0 } )
358369 )
@@ -361,6 +372,16 @@ describe('Oracle Fusion Financials provider', () => {
361372 )
362373 . mockResolvedValueOnce ( response ( 200 , page ( [ { CheckId : 'not-a-number' } ] ) ) )
363374
375+ await expect (
376+ executeOracleFusionFinancialsOperation (
377+ 'oracle_fusion_financials_list_payables_payments' ,
378+ AUTH
379+ )
380+ ) . rejects . toMatchObject ( {
381+ name : 'OracleFusionFinancialsProviderError' ,
382+ status : 502 ,
383+ message : 'Oracle Fusion Financials returned an unexpected response shape' ,
384+ } )
364385 await expect (
365386 executeOracleFusionFinancialsOperation (
366387 'oracle_fusion_financials_list_payables_payments' ,
0 commit comments