All tests are passing!

This commit is contained in:
Robert Schäfer 2019-02-20 12:56:57 +01:00
parent c30548d1e8
commit bfc5603fa8
2 changed files with 2 additions and 2 deletions

View File

@ -16,7 +16,7 @@ const isUniqueFor = (context, type) => {
export default { export default {
Mutation: { Mutation: {
CreatePost: async (resolve, root, args, context, info) => { CreatePost: async (resolve, root, args, context, info) => {
args.slug = await uniqueSlug(args.title, isUniqueFor(context, 'Post')) args.slug = args.slug || await uniqueSlug(args.title, isUniqueFor(context, 'Post'))
const result = await resolve(root, args, context, info) const result = await resolve(root, args, context, info)
return result return result
}, },

View File

@ -53,7 +53,7 @@ describe('slugify', () => {
slug: "pre-existing-post" slug: "pre-existing-post"
) { slug } ) { slug }
}`) }`)
).rejects.toThrow('Unique constraint error') ).rejects.toThrow('already exists')
}) })
}) })
}) })