Fixed tests
parent
b93efe932b
commit
bfaa034467
|
@ -135,7 +135,7 @@ module.exports = (app, passport) => {
|
||||||
if (!mw.validateEmail(req.body.email)) {
|
if (!mw.validateEmail(req.body.email)) {
|
||||||
debug(`Email ${req.body.email} was found invalid!`)
|
debug(`Email ${req.body.email} was found invalid!`)
|
||||||
req.flash('warning', `The email you entered, ${req.body.email} isn't valid. Try again. `)
|
req.flash('warning', `The email you entered, ${req.body.email} isn't valid. Try again. `)
|
||||||
res.redirect('/login#login')
|
res.redirect('/login#signup')
|
||||||
next()
|
next()
|
||||||
|
|
||||||
// Valid email
|
// Valid email
|
||||||
|
|
18
test/auth.js
18
test/auth.js
|
@ -38,10 +38,10 @@ describe('Authentication', () => {
|
||||||
).to.redirectTo('/login#signup')
|
).to.redirectTo('/login#signup')
|
||||||
|
|
||||||
/* Ensure user was deleted after email failed to send
|
/* Ensure user was deleted after email failed to send
|
||||||
/* Users with bad emails are removed asynchronously and may happen after
|
* Users with bad emails are removed asynchronously and may happen after
|
||||||
/* the response was recieved. Ensure it's happened in a kludgy way by
|
* the response was recieved. Ensure it's happened in a kludgy way by
|
||||||
/* waiting 2 seconds before asserting that the user doesn't exist
|
* waiting 2 seconds before asserting that the user doesn't exist
|
||||||
*/
|
*/
|
||||||
setTimeout( async () => {
|
setTimeout( async () => {
|
||||||
chai.assert.isNull( await User.findOne({
|
chai.assert.isNull( await User.findOne({
|
||||||
'email': FAKE_EMAIL
|
'email': FAKE_EMAIL
|
||||||
|
@ -61,10 +61,10 @@ describe('Authentication', () => {
|
||||||
).to.redirectTo('/login#signup')
|
).to.redirectTo('/login#signup')
|
||||||
|
|
||||||
/* Ensure user was deleted after email failed to send
|
/* Ensure user was deleted after email failed to send
|
||||||
/* Users with bad emails are removed asynchronously and may happen after
|
* Users with bad emails are removed asynchronously and may happen after
|
||||||
/* the response was recieved. Ensure it's happened in a kludgy way by
|
* the response was recieved. Ensure it's happened in a kludgy way by
|
||||||
/* waiting 2 seconds before asserting that the user doesn't exist
|
* waiting 2 seconds before asserting that the user doesn't exist
|
||||||
*/
|
*/
|
||||||
setTimeout( async () => {
|
setTimeout( async () => {
|
||||||
chai.assert.isNull( await User.findOne({
|
chai.assert.isNull( await User.findOne({
|
||||||
'email': fuzzed_email
|
'email': fuzzed_email
|
||||||
|
@ -159,7 +159,7 @@ describe('Authentication', () => {
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it.skip('Loads forgot password page', async () => {
|
it('Loads forgot password page', async () => {
|
||||||
let res = await request.get('/login/forgot')
|
let res = await request.get('/login/forgot')
|
||||||
chai.expect(res).html.to.have.status(200)
|
chai.expect(res).html.to.have.status(200)
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue