Initial pass at email confirmation

This commit is contained in:
Wyatt Johnson
2017-01-03 17:35:58 -07:00
parent b7380978f5
commit a7680ae5d9
23 changed files with 498 additions and 285 deletions
+11 -4
View File
@@ -19,22 +19,29 @@ describe('/api/v1/auth', () => {
});
});
const Setting = require('../../../../models/setting');
const settings = {id: '1'};
describe('/api/v1/auth/local', () => {
beforeEach(() => {
return User.createLocalUser('maria@gmail.com', 'password!', 'Maria');
});
beforeEach(() => Promise.all([
User.createLocalUser('maria@gmail.com', 'password!', 'Maria'),
Setting.init(settings)
]));
describe('#post', () => {
it('should send back the user on a successful login', () => {
return chai.request(app)
.post('/api/v1/auth/local')
.send({email: 'maria@gmail.com', password: 'password!'})
.catch((res) => {
.then((res) => {
expect(res).to.have.status(200);
expect(res).to.be.json;
expect(res.body).to.have.property('user');
expect(res.body.user).to.have.property('displayName', 'Maria');
})
.catch((err) => {
console.error(err);
});
});