test login event

This commit is contained in:
Ulf Gebhardt 2023-02-13 12:33:46 +01:00
parent 8424417cde
commit 38c5f6ff5d
Signed by: ulfgebhardt
GPG Key ID: DA6B843E748679C9

View File

@ -647,6 +647,19 @@ describe('UserResolver', () => {
it('sets the token in the header', () => { it('sets the token in the header', () => {
expect(headerPushMock).toBeCalledWith({ key: 'token', value: expect.any(String) }) 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', () => { describe('user is in database and wrong password', () => {