added tests
This commit is contained in:
parent
9c4eef5912
commit
4e029d3ce0
@ -406,10 +406,11 @@ describe('emailstore test', function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe.only('resend validation email', function () {
|
describe('resend validation email', function () {
|
||||||
var email = 'fake@email.com';
|
var email = 'fake@email.com';
|
||||||
var secret = '123';
|
var secret = '123';
|
||||||
beforeEach(function() {
|
beforeEach(function() {
|
||||||
|
leveldb_stub.get.reset();
|
||||||
request.param.onFirstCall().returns(email);
|
request.param.onFirstCall().returns(email);
|
||||||
response.json.returnsThis();
|
response.json.returnsThis();
|
||||||
response.redirect = sinon.stub();
|
response.redirect = sinon.stub();
|
||||||
@ -423,6 +424,23 @@ describe('emailstore test', function() {
|
|||||||
plugin.sendVerificationEmail.calledOnce.should.be.true;
|
plugin.sendVerificationEmail.calledOnce.should.be.true;
|
||||||
plugin.sendVerificationEmail.calledWith(email, secret).should.be.true;
|
plugin.sendVerificationEmail.calledWith(email, secret).should.be.true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should resend validation email when pending (old style secret)', function () {
|
||||||
|
plugin.authorizeRequestWithoutKey = sinon.stub().callsArgWith(1, null, email);
|
||||||
|
leveldb_stub.get.onFirstCall().callsArgWith(1, null, secret);
|
||||||
|
plugin.sendVerificationEmail = sinon.spy();
|
||||||
|
plugin.resendEmail(request, response);
|
||||||
|
plugin.sendVerificationEmail.calledOnce.should.be.true;
|
||||||
|
plugin.sendVerificationEmail.calledWith(email, secret).should.be.true;
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should not resend when email is no longer pending', function () {
|
||||||
|
plugin.authorizeRequestWithoutKey = sinon.stub().callsArgWith(1, null, email);
|
||||||
|
leveldb_stub.get.onFirstCall().callsArgWith(1, { notFound: true });
|
||||||
|
plugin.sendVerificationEmail = sinon.spy();
|
||||||
|
plugin.resendEmail(request, response);
|
||||||
|
plugin.sendVerificationEmail.should.not.be.called;
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('removing items', function() {
|
describe('removing items', function() {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user