File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed
packages/testing/src/mocks Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -71,6 +71,19 @@ vi.mock('@/executor/path')
7171vi . mock ( '@/executor/resolver' , ( ) => ( {
7272 InputResolver : vi . fn ( ) ,
7373} ) )
74+ vi . mock ( '@/executor/utils/http' , ( ) => ( {
75+ buildAuthHeaders : vi . fn ( ) . mockResolvedValue ( { 'Content-Type' : 'application/json' } ) ,
76+ buildAPIUrl : vi . fn ( ( path : string ) => new URL ( path , 'http://localhost:3000' ) ) ,
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+ } ) )
7487
7588// Specific block utilities
7689vi . mock ( '@/blocks/blocks/router' )
You can’t perform that action at this time.
0 commit comments