File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ let undiciInterceptable: Interceptable;
1010type BodyMatcher = ( body : string | Record < string , any > ) => boolean ;
1111
1212interface MockParams {
13- method : "GET" | "POST" ;
13+ method : "GET" | "POST" | "DELETE" ;
1414 path : string ;
1515 query ?: Record < string , any > ;
1616 body ?: BodyMatcher ;
@@ -42,6 +42,8 @@ export const mockRequest = ({
4242 interceptor = nockScope . get ( newPath ) ;
4343 } else if ( method === "POST" ) {
4444 interceptor = nockScope . post ( newPath , body ) ;
45+ } else if ( method === "DELETE" ) {
46+ interceptor = nockScope . delete ( newPath ) ;
4547 }
4648
4749 interceptor
Original file line number Diff line number Diff line change @@ -299,4 +299,23 @@ describe("Backlog API", () => {
299299 throw err
300300 } ) ;
301301 } ) ;
302+
303+ it ( 'should remove star.' , ( done ) => {
304+ const starId = 123 ;
305+ mockRequest ( {
306+ method : "DELETE" ,
307+ path : `/api/v2/stars/${ starId } ` ,
308+ query : { apiKey } ,
309+ status : 204 ,
310+ data : [ ] ,
311+ times : 1 ,
312+ } ) ;
313+ backlog . removeStar ( starId ) . then ( data => {
314+ // Should resolve without error and without any value
315+ assert ( data === undefined ) ;
316+ done ( ) ;
317+ } ) . catch ( err => {
318+ throw err ;
319+ } ) ;
320+ } ) ;
302321} ) ;
You can’t perform that action at this time.
0 commit comments