mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2026-01-20 20:01:25 +00:00
test that a post written by muted user is not included in the search results
This commit is contained in:
parent
d47274fb8e
commit
0a15d785a3
@ -44,6 +44,7 @@ const searchQuery = gql`
|
||||
}
|
||||
}
|
||||
`
|
||||
let user
|
||||
|
||||
describe('resolvers', () => {
|
||||
describe('searches', () => {
|
||||
@ -51,7 +52,7 @@ describe('resolvers', () => {
|
||||
|
||||
describe('given one user', () => {
|
||||
beforeAll(async () => {
|
||||
const user = await Factory.build('user', {
|
||||
user = await Factory.build('user', {
|
||||
id: 'a-user',
|
||||
name: 'John Doe',
|
||||
slug: 'john-doe',
|
||||
@ -407,6 +408,44 @@ und hinter tausend Stäben keine Welt.`,
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe('adding a post, written by a user who is muted by the authenticated user', () => {
|
||||
beforeAll(async () => {
|
||||
const mutedUser = await Factory.build('user', {
|
||||
id: 'muted-user',
|
||||
name: 'Muted',
|
||||
slug: 'muted',
|
||||
})
|
||||
await user.relateTo(mutedUser, 'muted')
|
||||
await Factory.build(
|
||||
'post',
|
||||
{
|
||||
id: 'muted-post',
|
||||
title: 'Beleidigender Beitrag',
|
||||
content: 'Dieser Beitrag stammt von einem bleidigendem Nutzer.',
|
||||
},
|
||||
{ authorId: 'muted-user' },
|
||||
)
|
||||
})
|
||||
|
||||
describe('query for text in a post written by a muted user', () => {
|
||||
it('does not include the post of the muted user in the results', async () => {
|
||||
variables = { query: 'beitrag' }
|
||||
await expect(query({ query: searchQuery, variables })).resolves.toMatchObject({
|
||||
data: {
|
||||
findResources: expect.not.arrayContaining([
|
||||
{
|
||||
__typename: 'Post',
|
||||
id: 'muted-post',
|
||||
title: 'Beleidigender Beitrag',
|
||||
content: 'Dieser Beitrag stammt von einem bleidigendem Nutzer.',
|
||||
},
|
||||
]),
|
||||
},
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user