From 38c5f6ff5d8b28d8daa4aa48abb18a752209dca8 Mon Sep 17 00:00:00 2001 From: Ulf Gebhardt Date: Mon, 13 Feb 2023 12:33:46 +0100 Subject: [PATCH] test login event --- backend/src/graphql/resolver/UserResolver.test.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/backend/src/graphql/resolver/UserResolver.test.ts b/backend/src/graphql/resolver/UserResolver.test.ts index 17eddca94..e3a1bacd8 100644 --- a/backend/src/graphql/resolver/UserResolver.test.ts +++ b/backend/src/graphql/resolver/UserResolver.test.ts @@ -647,6 +647,19 @@ describe('UserResolver', () => { it('sets the token in the header', () => { expect(headerPushMock).toBeCalledWith({ key: 'token', value: expect.any(String) }) }) + + it('stores the login event in the database', async () => { + const userConatct = await UserContact.findOneOrFail( + { email: 'bibi@bloxberg.de' }, + { relations: ['user'] }, + ) + expect(EventProtocol.find()).resolves.toContainEqual( + expect.objectContaining({ + type: EventProtocolType.LOGIN, + userId: userConatct.user.id, + }), + ) + }) }) describe('user is in database and wrong password', () => {