-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9eab96b
commit 477f8c1
Showing
5 changed files
with
20 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -207,44 +207,10 @@ describe('Password Reset', () => { | |
sinon.assert.calledWithMatch(sendSpy, { | ||
data: { | ||
to: '[email protected]', | ||
from: sinon.match(/noreply@/), | ||
subject: 'üWave Password Reset Request', | ||
text: sinon.match(/http:\/\/127\.0\.0\.1:\d+\/reset\//), | ||
}, | ||
}); | ||
}); | ||
|
||
it('uses a custom email body', async () => { | ||
const sendSpy = sandbox.spy(mailTransport, 'send'); | ||
uw = await createUwave('pw_reset', { | ||
mailTransport, | ||
createPasswordResetEmail({ token }) { | ||
assert.strictEqual(typeof token, 'string'); | ||
return { | ||
from: '[email protected]', | ||
subject: 'Custom Subject', | ||
text: 'Text body', | ||
html: '<b>HTML body</b>', | ||
}; | ||
}, | ||
}); | ||
|
||
const user = await uw.test.createUser(); | ||
await uw.models.Authentication.create({ | ||
email: '[email protected]', | ||
user, | ||
hash: 'passwordhash', | ||
}); | ||
|
||
await supertest(uw.server) | ||
.post('/api/auth/password/reset') | ||
.send({ email: '[email protected]' }) | ||
.expect(200); | ||
|
||
sinon.assert.calledWithMatch(sendSpy, { | ||
data: { | ||
from: '[email protected]', | ||
subject: 'Custom Subject', | ||
text: 'Text body', | ||
html: '<b>HTML body</b>', | ||
html: sinon.match(/http:\/\/127\.0\.0\.1:\d+\/reset\//), | ||
}, | ||
}); | ||
}); | ||
|