Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
TSLarson committed Oct 2, 2024
1 parent ce03bf1 commit 04f7ec5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion test/captcha_signup.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,12 @@ describe('captcha on signup', function () {

describe('when the challenge api returns required: false', function () {
let notRequiredStub;
let loginGetChallengeStub;
beforeEach(function (done) {
notRequiredStub = h.stubGetSignupChallenge({
required: false
});
loginGetChallengeStub = h.stubGetChallenge([recaptchav2Response]);
this.lock = h.displayLock('', lockOpts, done);
});

Expand All @@ -169,6 +171,7 @@ describe('captcha on signup', function () {
});

it('should not show the captcha input', function () {
expect(loginGetChallengeStub.calledOnce).to.be.false;
expect(h.q(this.lock, '.auth0-lock-recaptchav2')).to.not.be.ok();
});

Expand All @@ -181,7 +184,7 @@ describe('captcha on signup', function () {
setTimeout(done, 260);
});

challengeStub = h.stubGetSignupChallenge(recaptchav2Response);
challengeStub = h.stubGetSignupChallenge([recaptchav2Response]);
h.fillEmailInput(this.lock, '[email protected]');
h.fillComplexPassword(this.lock);
h.submitForm(this.lock);
Expand All @@ -190,6 +193,7 @@ describe('captcha on signup', function () {
it('should call the challenge api again and show the input', function () {
expect(notRequiredStub.calledOnce).to.be.true;
expect(challengeStub.calledOnce).to.be.true;
expect(loginGetChallengeStub.calledOnce).to.be.false;
expect(h.q(this.lock, '.auth0-lock-recaptchav2')).to.be.ok();
});
});
Expand Down

0 comments on commit 04f7ec5

Please sign in to comment.