Sketch test for #1054

This commit is contained in:
Robert Schäfer 2019-08-07 12:56:28 +02:00 committed by roschaefer
parent 5c0432d855
commit 6950068a12
2 changed files with 55 additions and 0 deletions

View File

@ -0,0 +1,44 @@
import { createTestClient } from 'apollo-server-testing'
import createServer from '../../../server'
import { gql } from '../../../jest/helpers'
describe('blockedUsers', () => {
it.todo('throws permission error')
describe('authenticated', () => {
it.todo('returns a list of blocked users')
})
})
describe('block', () => {
it.todo('throws permission error')
describe('authenticated', () => {
it.todo('throws argument error')
describe('given a to-be-blocked user', () => {
it.todo('blocks a user')
describe('blocked user writes a post', () => {
it.todo('disappears in the newsfeed of the current user')
})
describe('current user writes a post', () => {
it.todo('disappears in the newsfeed of the blocked user')
})
})
})
})
describe('unblock', () => {
it.todo('throws permission error')
describe('authenticated', () => {
it.todo('throws argument error')
describe('given a blocked user', () => {
it.todo('unblocks a user')
describe('unblocking twice', () => {
it.todo('has no effect')
})
})
})
})

View File

@ -42,6 +42,12 @@ type User {
RETURN COUNT(u) >= 1
"""
)
isBlocked: Boolean! @cypher(
statement: """
MATCH (this)-[:BLOCKED]->(u:User {id: $cypherParams.currentUserId})
RETURN COUNT(u) >= 1
"""
)
#contributions: [WrittenPost]!
#contributions2(first: Int = 10, offset: Int = 0): [WrittenPost2]!
@ -164,4 +170,9 @@ type Mutation {
): User
DeleteUser(id: ID!, resource: [Deletable]): User
block(id: ID!): User
unblock(id: ID!): User
blockedUsers: [User]
}