Skip to content

Commit 8063195

Browse files
committed
Add destroy integration test
1 parent b033453 commit 8063195

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

test/integration/VuexORMApollo.spec.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,4 +251,47 @@ mutation UpdateUser($user: UserInput!) {
251251
`.trim() + "\n");
252252
});
253253
});
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+
});
254297
});

0 commit comments

Comments
 (0)