mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
test filter posts in my groups
This commit is contained in:
parent
d41b99b913
commit
11a7dc2881
@ -60,7 +60,7 @@ beforeAll(async () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
afterAll(async () => {
|
afterAll(async () => {
|
||||||
await cleanDatabase()
|
// await cleanDatabase()
|
||||||
driver.close()
|
driver.close()
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -1678,5 +1678,59 @@ describe('Posts in Groups', () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe('filter posts in my groups', () => {
|
||||||
|
describe('without any posts in groups', () => {
|
||||||
|
beforeAll(async () => {
|
||||||
|
authenticatedUser = await anyUser.toJson()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('finds no posts', async () => {
|
||||||
|
const result = await query({
|
||||||
|
query: filterPosts(),
|
||||||
|
variables: { filter: { postsInMyGroups: true } },
|
||||||
|
})
|
||||||
|
expect(result.data.Post).toHaveLength(0)
|
||||||
|
expect(result).toMatchObject({
|
||||||
|
data: {
|
||||||
|
Post: [],
|
||||||
|
},
|
||||||
|
errors: undefined,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('with posts in groups', () => {
|
||||||
|
beforeAll(async () => {
|
||||||
|
// member of hidden-group and closed-group
|
||||||
|
authenticatedUser = await allGroupsUser.toJson()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('finds two posts', async () => {
|
||||||
|
const result = await query({
|
||||||
|
query: filterPosts(),
|
||||||
|
variables: { filter: { postsInMyGroups: true } },
|
||||||
|
})
|
||||||
|
expect(result.data.Post).toHaveLength(2)
|
||||||
|
expect(result).toMatchObject({
|
||||||
|
data: {
|
||||||
|
Post: expect.arrayContaining([
|
||||||
|
{
|
||||||
|
id: 'post-to-closed-group',
|
||||||
|
title: 'A post to a closed group',
|
||||||
|
content: 'I am posting into a closed group as a member of the group',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: 'post-to-hidden-group',
|
||||||
|
title: 'A post to a hidden group',
|
||||||
|
content: 'I am posting into a hidden group as a member of the group',
|
||||||
|
},
|
||||||
|
]),
|
||||||
|
},
|
||||||
|
errors: undefined,
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user