Skip to content

Commit

Permalink
Test for error during delete
Browse files Browse the repository at this point in the history
  • Loading branch information
benjie committed Aug 24, 2017
1 parent 6df0b83 commit 5366d2d
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
mutation {
deleteTypeById(input: { id: 12 }) {
clientMutationId
deletedTypeId
type {
nodeId
id
}
query {
nodeId
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,17 @@ Object {
}
`;

exports[`mutation-delete-error.graphql 1`] = `
Object {
"data": Object {
"deleteTypeById": null,
},
"errors": Array [
[GraphQLError: Nope.],
],
}
`;

exports[`mutation-update.graphql 1`] = `
Object {
"data": Object {
Expand Down
9 changes: 9 additions & 0 deletions packages/postgraphile-core/__tests__/kitchen-sink-schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,15 @@ create table b.types (
"nested_compound_type" b.nested_compound_type not null
);

create function b.throw_error() returns trigger as $$
begin
raise exception 'Nope.';
return new;
end;
$$ language plpgsql;

create trigger dont_delete before delete on b.types for each row execute procedure b.throw_error();

create function a.add_1_mutation(int, int) returns int as $$ select $1 + $2 $$ language sql volatile strict;
create function a.add_2_mutation(a int, b int default 2) returns int as $$ select $1 + $2 $$ language sql strict;
create function a.add_3_mutation(a int, int) returns int as $$ select $1 + $2 $$ language sql volatile;
Expand Down

0 comments on commit 5366d2d

Please sign in to comment.