mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +00:00
Rename value of enum type to following
As discussed in our daily standup with @mattwr18
This commit is contained in:
parent
0d8a748094
commit
d59c43330b
@ -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' }],
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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(
|
||||||
|
|||||||
@ -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 () => {
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
enum FilterBubbleAuthorEnum {
|
enum FilterBubbleAuthorEnum {
|
||||||
followed
|
following
|
||||||
all
|
all
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user