@@ -1107,22 +1107,14 @@ describe('delete', () => {
1107
1107
const mockStore = new MockFetch ( )
1108
1108
. delete ( {
1109
1109
headers : { authorization : `Bearer ${ apiToken } ` } ,
1110
- response : new Response ( JSON . stringify ( { url : signedURL } ) ) ,
1110
+ response : new Response ( null , { status : 204 } ) ,
1111
1111
url : `https://api.netlify.com/api/v1/blobs/${ siteID } /site:production/${ key } ` ,
1112
1112
} )
1113
- . delete ( {
1114
- response : new Response ( null ) ,
1115
- url : signedURL ,
1116
- } )
1117
1113
. delete ( {
1118
1114
headers : { authorization : `Bearer ${ apiToken } ` } ,
1119
- response : new Response ( JSON . stringify ( { url : signedURL } ) ) ,
1115
+ response : new Response ( null , { status : 204 } ) ,
1120
1116
url : `https://api.netlify.com/api/v1/blobs/${ siteID } /site:production/${ complexKey } ` ,
1121
1117
} )
1122
- . delete ( {
1123
- response : new Response ( null ) ,
1124
- url : signedURL ,
1125
- } )
1126
1118
1127
1119
globalThis . fetch = mockStore . fetch
1128
1120
@@ -1139,16 +1131,11 @@ describe('delete', () => {
1139
1131
} )
1140
1132
1141
1133
test ( 'Does not throw when the blob does not exist' , async ( ) => {
1142
- const mockStore = new MockFetch ( )
1143
- . delete ( {
1144
- headers : { authorization : `Bearer ${ apiToken } ` } ,
1145
- response : new Response ( JSON . stringify ( { url : signedURL } ) ) ,
1146
- url : `https://api.netlify.com/api/v1/blobs/${ siteID } /site:production/${ key } ` ,
1147
- } )
1148
- . delete ( {
1149
- response : new Response ( null , { status : 404 } ) ,
1150
- url : signedURL ,
1151
- } )
1134
+ const mockStore = new MockFetch ( ) . delete ( {
1135
+ headers : { authorization : `Bearer ${ apiToken } ` } ,
1136
+ response : new Response ( null , { status : 404 } ) ,
1137
+ url : `https://api.netlify.com/api/v1/blobs/${ siteID } /site:production/${ key } ` ,
1138
+ } )
1152
1139
1153
1140
globalThis . fetch = mockStore . fetch
1154
1141
@@ -1178,7 +1165,7 @@ describe('delete', () => {
1178
1165
siteID,
1179
1166
} )
1180
1167
1181
- expect ( async ( ) => await blobs . delete ( key ) ) . rejects . toThrowError (
1168
+ await expect ( async ( ) => await blobs . delete ( key ) ) . rejects . toThrowError (
1182
1169
`Netlify Blobs has generated an internal error: 401 response` ,
1183
1170
)
1184
1171
expect ( mockStore . fulfilled ) . toBeTruthy ( )
0 commit comments