Match error message in tests with production code

This commit is contained in:
Robert Schäfer 2019-01-02 15:15:48 +01:00
parent ffafd72c79
commit 7634234afd
2 changed files with 5 additions and 5 deletions

View File

@ -111,7 +111,7 @@ export const resolvers = {
return Object.assign(currentUser, {
token: generateJwt(currentUser)
})
} else throw new AuthenticationError('Incorrect username or password.')
} else throw new AuthenticationError('Incorrect email address or password.')
})
}
}

View File

@ -55,21 +55,21 @@ describe.only('login', () => {
})
describe('with a valid email but incorrect password', () => {
it('responds with "Wrong email/password combination"', async () => {
it('responds with "Incorrect email address or password."', async () => {
try {
await request(getHost(), mutation({email: 'test@example.org', password: 'wrong'}))
} catch (error) {
expect(error.response.errors[0].message).toEqual('Wrong email/password combination')
expect(error.response.errors[0].message).toEqual('Incorrect email address or password.')
}
})
})
describe('with a non-existing email', () => {
it('responds with "Wrong email/password combination"', async () => {
it('responds with "Incorrect email address or password."', async () => {
try {
await request(getHost(), mutation({email: 'non-existent@example.org', password: 'wrong'}))
} catch (error) {
expect(error.response.errors[0].message).toEqual('Wrong email/password combination')
expect(error.response.errors[0].message).toEqual('Incorrect email address or password.')
}
})
})