Skip to content

Commit

Permalink
Add unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
leonid-regrello committed May 21, 2024
1 parent 1689c65 commit ec09a5f
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/web-auth/web-auth.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1897,6 +1897,23 @@ describe('auth0.WebAuth', function () {
expect(args.organization).to.eql('org_123');
expect(args.invitation).to.eql('inv_123');
});
it('should fire the provided callback before redirecting', function () {
let mockCalledTimes = 0;
let mockFn = () => { mockCalledTimes++ };

var webAuth = new WebAuth({
domain: 'me.auth0.com',
redirectUri: 'http://page.com/callback',
clientID: '...',
responseType: 'token',
_sendTelemetry: false
});

sinon.spy(webAuth.client, 'buildAuthorizeUrl');

webAuth.authorize({}, mockFn);
expect(mockCalledTimes).to.be.equal(1);
});
});

context('renewAuth', function () {
Expand Down

0 comments on commit ec09a5f

Please sign in to comment.