File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
apps/sim/executor/handlers/agent Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -61,6 +61,30 @@ vi.mock('@/providers', () => ({
6161 } ) ,
6262} ) )
6363
64+ vi . mock ( '@/executor/utils/http' , ( ) => ( {
65+ buildAuthHeaders : vi . fn ( ) . mockResolvedValue ( { 'Content-Type' : 'application/json' } ) ,
66+ buildAPIUrl : vi . fn ( ( path : string , params ?: Record < string , string > ) => {
67+ const url = new URL ( path , 'http://localhost:3000' )
68+ if ( params ) {
69+ for ( const [ key , value ] of Object . entries ( params ) ) {
70+ if ( value !== undefined && value !== null ) {
71+ url . searchParams . set ( key , value )
72+ }
73+ }
74+ }
75+ return url
76+ } ) ,
77+ extractAPIErrorMessage : vi . fn ( async ( response : Response ) => {
78+ const defaultMessage = `API request failed with status ${ response . status } `
79+ try {
80+ const errorData = await response . json ( )
81+ return errorData . error || defaultMessage
82+ } catch {
83+ return defaultMessage
84+ }
85+ } ) ,
86+ } ) )
87+
6488vi . mock ( '@sim/db' , ( ) => ( {
6589 db : {
6690 select : vi . fn ( ) . mockReturnValue ( {
You can’t perform that action at this time.
0 commit comments