diff --git a/tests/routes/auth.spec.js b/tests/routes/auth.spec.js index d19ab41..4f24026 100644 --- a/tests/routes/auth.spec.js +++ b/tests/routes/auth.spec.js @@ -128,7 +128,7 @@ describe('POST /auth/login', () => { }); }); - it('should not sign user in if invalid email or password is provided', (done) => { + it('should not sign user in if non-existent email is provided', (done) => { chai.request(app) .post('/api/v1/auth/login') .send(seedData.users.invalidUser) @@ -141,6 +141,19 @@ describe('POST /auth/login', () => { }); }); + it('should not sign user in if invalid password is provided', (done) => { + chai.request(app) + .post('/api/v1/auth/login') + .send(seedData.users.validUserInvalidPass) + .end((err, res) => { + if (err) done(err); + + res.status.should.eql(400); + res.body.should.not.have.keys(['auth_token']); + done(); + }); + }); + it('should not sign in user with improper input format', (done) => { chai.request(app) .post('/api/v1/auth/login') diff --git a/tests/seed/seed.js b/tests/seed/seed.js index d6e18e6..5110f34 100644 --- a/tests/seed/seed.js +++ b/tests/seed/seed.js @@ -15,6 +15,10 @@ const seedData = { password: 'pixel2user', confirmPassword: 'pixel2user', }, + validUserInvalidPass: { + email: 'daniel@james.com', + password: 'thisiswrong', + }, invalidUser: { name: 'four-O-four', email: 'no@email.address',