From 45ef5be81b781eadc2f406fc521c155a6ce8987a Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Tue, 20 Jun 2023 11:20:44 +0200 Subject: [PATCH] test with second message --- backend/src/schema/resolvers/messages.spec.ts | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/backend/src/schema/resolvers/messages.spec.ts b/backend/src/schema/resolvers/messages.spec.ts index ecdcfd9a6..e9cf26a22 100644 --- a/backend/src/schema/resolvers/messages.spec.ts +++ b/backend/src/schema/resolvers/messages.spec.ts @@ -202,6 +202,47 @@ describe('Message', () => { }, }) }) + + describe('more messages', () => { + beforeAll(async () => { + await mutate({ + mutation: createMessageMutation(), + variables: { + roomId, + content: 'Another nice message to other chatting user', + } + }) + }) + + it('returns the messages', async () => { + await expect(query({ + query: messageQuery(), + variables: { + roomId, + }, + })).resolves.toMatchObject({ + errors: undefined, + data: { + Message: [ + { + id: expect.any(String), + content: 'Some nice message to other chatting user', + author: { + id: 'chatting-user', + }, + }, + { + id: expect.any(String), + content: 'Another nice message to other chatting user', + author: { + id: 'other-chatting-user', + }, + } + ], + }, + }) + }) + }) }) describe('room exists, authenticated user not in room', () => {