Rename value of enum type to following

As discussed in our daily standup with @mattwr18
This commit is contained in:
Robert Schäfer 2019-06-05 18:34:02 +02:00
parent 0d8a748094
commit d59c43330b
4 changed files with 8 additions and 8 deletions

View File

@ -65,7 +65,7 @@ describe('FilterBubble middleware', () => {
describe('filtering for posts of followed users only', () => { describe('filtering for posts of followed users only', () => {
it('returns only posts authored by followed users', async () => { it('returns only posts authored by followed users', async () => {
const query = '{ Post( filterBubble: { author: followed }) { title } }' const query = '{ Post( filterBubble: { author: following }) { title } }'
const expected = { const expected = {
Post: [{ title: 'This is the post of a followed user' }], Post: [{ title: 'This is the post of a followed user' }],
} }

View File

@ -4,9 +4,9 @@ export default async function replaceParams(args, context) {
const { author = 'all' } = args.filterBubble || {} const { author = 'all' } = args.filterBubble || {}
const { user } = context const { user } = context
if (author === 'followed') { if (author === 'following') {
if (!user) if (!user)
throw new UserInputError("You are unauthenticated - I don't know your followed users") throw new UserInputError("You are unauthenticated - I don't know any users you are following.")
const session = context.driver.session() const session = context.driver.session()
let { records } = await session.run( let { records } = await session.run(

View File

@ -38,9 +38,9 @@ describe('replaceParams', () => {
context.user = null context.user = null
}) })
describe('{ filterBubble: { author: followed } }', () => { describe('{ filterBubble: { author: following } }', () => {
it('throws error', async () => { it('throws error', async () => {
args = { filterBubble: { author: 'followed' } } args = { filterBubble: { author: 'following' } }
await expect(action()).rejects.toThrow('You are unauthenticated') await expect(action()).rejects.toThrow('You are unauthenticated')
}) })
}) })
@ -63,9 +63,9 @@ describe('replaceParams', () => {
context.user = { id: 'u4711' } context.user = { id: 'u4711' }
}) })
describe('{ filterBubble: { author: followed } }', () => { describe('{ filterBubble: { author: following } }', () => {
beforeEach(() => { beforeEach(() => {
args = { filterBubble: { author: 'followed' } } args = { filterBubble: { author: 'following' } }
}) })
it('returns args object with resolved ids of followed users', async () => { it('returns args object with resolved ids of followed users', async () => {

View File

@ -1,5 +1,5 @@
enum FilterBubbleAuthorEnum { enum FilterBubbleAuthorEnum {
followed following
all all
} }