Commit 4e2f8ef1 authored by Denys Mishunov's avatar Denys Mishunov

Expect GraphQL errors to be an Array

parent ac4c5ded
......@@ -138,7 +138,7 @@ export default {
variables: { id: this.snippet.id },
})
.then(({ data }) => {
if (data?.destroySnippet?.errors) {
if (data?.destroySnippet?.errors.length) {
throw new Error(data?.destroySnippet?.errors[0]);
}
this.isDeleting = false;
......
......@@ -32,7 +32,9 @@ describe('Snippet header component', () => {
const errorMsg = 'Foo bar';
const err = { message: errorMsg };
const resolveMutate = jest.fn(() => Promise.resolve({ data: {} }));
const resolveMutate = jest.fn(() =>
Promise.resolve({ data: { destroySnippet: { errors: [] } } }),
);
const rejectMutation = jest.fn(() => Promise.reject(err));
const mutationTypes = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment