Skip to content

Commit

Permalink
handle results on delete mutations in tests differently then regular …
Browse files Browse the repository at this point in the history
…mutations
  • Loading branch information
chriskalmar committed Jan 30, 2021
1 parent 13c6f1e commit c1bc3f7
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions test/db.ts
Expand Up @@ -113,17 +113,30 @@ export const mutate = async (
) => {
const typeName = entity.name;

const entityMutation = entity.getMutationByName(mutationName);

const resolver = getMutationResolver({
entity,
entityMutation: entity.getMutationByName(mutationName),
entityMutation,
typeName,
nested: false,
idResolver: () => {
return id;
},
});

return resolver({}, { input: { [typeName]: payload } }, context, {});
const result = await resolver(
{},
{ input: { [typeName]: payload } },
context,
{},
);

if (entityMutation.isTypeDelete) {
return result;
}

return result[typeName];
};

export const findOne = async (entity, id, payload, context) => {
Expand Down

0 comments on commit c1bc3f7

Please sign in to comment.