From 2033b1791c50a8d892d899a7ccb70ec97c361e0b Mon Sep 17 00:00:00 2001 From: roschaefer Date: Sat, 31 Aug 2019 01:03:29 +0200 Subject: [PATCH] Fix posts resolver spec --- backend/src/schema/resolvers/posts.spec.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/backend/src/schema/resolvers/posts.spec.js b/backend/src/schema/resolvers/posts.spec.js index 62507af0e..9bf99c351 100644 --- a/backend/src/schema/resolvers/posts.spec.js +++ b/backend/src/schema/resolvers/posts.spec.js @@ -243,10 +243,9 @@ describe('UpdatePost', () => { } ` beforeEach(async () => { - const asAuthor = Factory() - await asAuthor.create('User', authorParams) - await asAuthor.authenticateAs(authorParams) - await asAuthor.create('Post', { + const user = await factory.create('User', authorParams) + await factory.create('Post', { + author: user, id: postId, title: oldTitle, content: oldContent, @@ -400,11 +399,10 @@ describe('DeletePost', () => { } beforeEach(async () => { - const asAuthor = Factory() - await asAuthor.create('User', authorParams) - await asAuthor.authenticateAs(authorParams) - await asAuthor.create('Post', { + const user = await factory.create('User', authorParams) + await factory.create('Post', { id: postId, + author: user, content: 'To be deleted', categoryIds, })