File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change @@ -251,4 +251,47 @@ mutation UpdateUser($user: UserInput!) {
251
251
` . trim ( ) + "\n" ) ;
252
252
} ) ;
253
253
} ) ;
254
+
255
+
256
+ describe ( 'destroy' , ( ) => {
257
+ it ( 'sends the correct query to the API' , async ( ) => {
258
+ const response = {
259
+ data : {
260
+ deleteUser : {
261
+ __typename : 'user' ,
262
+ id : 1 ,
263
+ name : 'Johnny Imba' ,
264
+ posts : {
265
+ __typename : 'post' ,
266
+ nodes : [ ]
267
+ }
268
+ }
269
+ }
270
+ } ;
271
+
272
+ const request = await sendWithMockFetch ( response , async ( ) => {
273
+ await store . dispatch ( 'entities/users/destroy' , { id : 1 } ) ;
274
+ } ) ;
275
+
276
+ expect ( request . variables ) . toEqual ( { where : 1 } ) ;
277
+ expect ( request . query ) . toEqual ( `
278
+ mutation DeleteUser($id: ID!) {
279
+ deleteUser(id: $id) {
280
+ id
281
+ name
282
+ posts {
283
+ nodes {
284
+ id
285
+ title
286
+ content
287
+ __typename
288
+ }
289
+ __typename
290
+ }
291
+ __typename
292
+ }
293
+ }
294
+ ` . trim ( ) + "\n" ) ;
295
+ } ) ;
296
+ } ) ;
254
297
} ) ;
You can’t perform that action at this time.
0 commit comments