File tree Expand file tree Collapse file tree 1 file changed +24
-2
lines changed Expand file tree Collapse file tree 1 file changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -248,7 +248,7 @@ describe('createAPIAction()', () => {
248
248
const payload = { id : 10 , name : 'james' } ;
249
249
expect ( createItem ( payload ) ) . to . deep . equal ( {
250
250
type,
251
- payload : payload ,
251
+ payload,
252
252
meta : {
253
253
api : true ,
254
254
method : 'POST' ,
@@ -270,7 +270,7 @@ describe('createAPIAction()', () => {
270
270
const payload = { id : 10 , name : 'james' } ;
271
271
expect ( updateItem ( payload ) ) . to . deep . equal ( {
272
272
type,
273
- payload : payload ,
273
+ payload,
274
274
meta : {
275
275
api : true ,
276
276
method : 'PUT' ,
@@ -284,5 +284,27 @@ describe('createAPIAction()', () => {
284
284
} ) ;
285
285
} ) ;
286
286
287
+ it ( 'test DELETE with Custom Endpoint' , ( ) => {
288
+ const customEndpoint = ( { id, accountID} ) => {
289
+ return `/user/${ id } /account/${ accountID } ` ;
290
+ } ;
291
+ const deleteItem = createAPIAction ( type , 'DELETE' , customEndpoint ) ;
292
+ const payload = { id : 10 , accountID : 25 } ;
293
+ expect ( deleteItem ( payload ) ) . to . deep . equal ( {
294
+ type,
295
+ payload,
296
+ meta : {
297
+ api : true ,
298
+ method : 'DELETE' ,
299
+ endpoint : '/user/10/account/25' ,
300
+ types : [
301
+ type . concat ( '_DELETE_REQUEST' ) ,
302
+ type . concat ( '_DELETE_SUCCESS' ) ,
303
+ type . concat ( '_DELETE_FAILURE' )
304
+ ]
305
+ }
306
+ } ) ;
307
+ } ) ;
308
+
287
309
} ) ;
288
310
} ) ;
You can’t perform that action at this time.
0 commit comments