Added email templating, and user welcome email

This commit is contained in:
Jori Lallo
2017-11-12 15:02:23 -08:00
parent 272cc158ea
commit 348e5f0b20
17 changed files with 463 additions and 14 deletions

View File

@ -10,6 +10,12 @@ afterAll(server.close);
describe.skip('#auth.signup', async () => {
it('should signup a new user', async () => {
const welcomeEmailMock = jest.fn();
jest.doMock('../mailer', () => {
return {
welcome: welcomeEmailMock,
};
});
const res = await server.post('/api/auth.signup', {
body: {
username: 'testuser',
@ -23,6 +29,7 @@ describe.skip('#auth.signup', async () => {
expect(res.status).toEqual(200);
expect(body.ok).toBe(true);
expect(body.data.user).toBeTruthy();
expect(welcomeEmailMock).toBeCalledWith('new.user@example.com');
});
it('should require params', async () => {