fix test, test pagination properly

This commit is contained in:
Ulf Gebhardt 2023-07-17 10:29:32 +02:00
parent 1e77e9aec0
commit b6fe28e1c4
Signed by: ulfgebhardt
GPG Key ID: DA6B843E748679C9

View File

@ -399,7 +399,7 @@ describe('Room', () => {
}) })
it('returns the rooms paginated', async () => { it('returns the rooms paginated', async () => {
expect(await query({ query: roomQuery(), variables: { first: 2, offset: 0 } })).toMatchObject( expect(await query({ query: roomQuery(), variables: { first: 3, offset: 0 } })).toMatchObject(
{ {
errors: undefined, errors: undefined,
data: { data: {
@ -450,11 +450,34 @@ describe('Room', () => {
}, },
]), ]),
}, },
{
id: expect.any(String),
roomId: expect.any(String),
roomName: 'Not Chatting User',
users: expect.arrayContaining([
{
_id: 'chatting-user',
id: 'chatting-user',
name: 'Chatting User',
avatar: {
url: expect.any(String),
},
},
{
_id: 'not-chatting-user',
id: 'not-chatting-user',
name: 'Not Chatting User',
avatar: {
url: expect.any(String),
},
},
]),
},
], ],
}, },
}, },
) )
expect(await query({ query: roomQuery(), variables: { first: 2, offset: 2 } })).toMatchObject( expect(await query({ query: roomQuery(), variables: { first: 3, offset: 3 } })).toMatchObject(
{ {
errors: undefined, errors: undefined,
data: { data: {