test case deleted User

This commit is contained in:
Ulf Gebhardt 2023-01-31 21:34:30 +01:00
parent 45a92e637a
commit 702a39af9a
Signed by: ulfgebhardt
GPG Key ID: DA6B843E748679C9

View File

@ -671,6 +671,40 @@ describe('UserResolver', () => {
expect(logger.error).toBeCalledWith('No user with this credentials', variables.email)
})
})
describe('user is in database but deleted', () => {
beforeAll(async () => {
jest.clearAllMocks()
const user = await userFactory(testEnv, bibiBloxberg)
// Hint: softRemove does not soft-delete the email contact of this user
await user.softRemove()
result = await mutate({ mutation: login, variables })
})
afterAll(async () => {
await cleanDB()
})
it('returns an error', () => {
expect(result).toEqual(
expect.objectContaining({
errors: [
new GraphQLError('This user was permanently deleted. Contact support for questions'),
],
}),
)
})
it('logs the error thrown', () => {
expect(logger.error).toBeCalledWith(
'This user was permanently deleted. Contact support for questions',
expect.objectContaining({
firstName: bibiBloxberg.firstName,
lastName: bibiBloxberg.lastName,
}),
)
})
})
})
describe('logout', () => {