From 420ea8a4d60747b77e0c0da8b0c70f1dfb28a9e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20Sch=C3=A4fer?= Date: Tue, 5 Mar 2019 16:15:31 +0100 Subject: [PATCH] Scaffold some tests for disabledBy relation --- src/resolvers/posts.spec.js | 46 +++++++++++++++++++++++++++++++++++++ src/schema.graphql | 1 + 2 files changed, 47 insertions(+) diff --git a/src/resolvers/posts.spec.js b/src/resolvers/posts.spec.js index 5603683eb..1601e3348 100644 --- a/src/resolvers/posts.spec.js +++ b/src/resolvers/posts.spec.js @@ -200,3 +200,49 @@ describe('DeletePost', () => { }) }) }) + +describe('AddPostDisabledBy', () => { + const mutation = ` + mutation { + AddPostDisabledBy(from: { id: "u8" }, to: { id: "p9" }) { + from { + id + } + to { + id + } + } + } + ` + it.todo('throws authorization error') + + describe('authenticated', () => { + it.todo('throws authorization error') + + describe('as moderator', () => { + it.todo('throws authorization error') + + describe('current user matches provided user', () => { + it.todo('sets current user') + it.todo('updates .disabled on post') + }) + }) + }) +}) + +describe('RemovePostDisabledBy', () => { + it.todo('throws authorization error') + + describe('authenticated', () => { + it.todo('throws authorization error') + + describe('as moderator', () => { + it.todo('throws authorization error') + + describe('current user matches provided user', () => { + it.todo('sets current user') + it.todo('updates .disabled on post') + }) + }) + }) +}) diff --git a/src/schema.graphql b/src/schema.graphql index 1f9bcb477..4c2a58505 100644 --- a/src/schema.graphql +++ b/src/schema.graphql @@ -133,6 +133,7 @@ type Post { visibility: VisibilityEnum deleted: Boolean disabled: Boolean + disabledBy: User! @relation(name: "DISABLED", direction: "IN") createdAt: String updatedAt: String