File tree Expand file tree Collapse file tree 1 file changed +4
-10
lines changed
Expand file tree Collapse file tree 1 file changed +4
-10
lines changed Original file line number Diff line number Diff line change @@ -9,20 +9,14 @@ import {
99const getChildren = ( node ?: PackageFileTree ) : PackageFileTree [ ] => node ?. children ?? [ ]
1010
1111const mockFetchOk = < T > ( body : T ) => {
12- const fetchMock = vi . fn ( ) . mockResolvedValue ( {
13- ok : true ,
14- json : async ( ) => body ,
15- } )
16- vi . stubGlobal ( 'fetch' , fetchMock )
12+ const fetchMock = vi . fn ( ) . mockResolvedValue ( body )
13+ vi . stubGlobal ( '$fetch' , fetchMock )
1714 return fetchMock
1815}
1916
2017const mockFetchError = ( status : number ) => {
21- const fetchMock = vi . fn ( ) . mockResolvedValue ( {
22- ok : false ,
23- status,
24- } )
25- vi . stubGlobal ( 'fetch' , fetchMock )
18+ const fetchMock = vi . fn ( ) . mockRejectedValue ( { response : { status } } )
19+ vi . stubGlobal ( '$fetch' , fetchMock )
2620 return fetchMock
2721}
2822
You can’t perform that action at this time.
0 commit comments