Skip to content

Commit

Permalink
fix: unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
xinhyao authored and maxinteger committed Nov 29, 2024
1 parent 36a617e commit ae9424d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ const Authorization = WebexPlugin.extend({
* @param {String} verificationUrl
* @returns {String}
*/
_generateQRCodeVerificationUrl(verificationUrl = '') {
_generateQRCodeVerificationUrl(verificationUrl) {
const baseUrl = 'https://web.webex.com/deviceAuth';
const urlParams = new URLSearchParams(new URL(verificationUrl).search);
const userCode = urlParams.get('userCode');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ describe('plugin-authorization-browser-first-party', () => {
it('should generate a QR code URL when a userCode is present', () => {
const verificationUrl = 'https://example.com/verify?userCode=123456';
const oauthHelperUrl = 'https://oauth-helper-a.wbx2.com/helperservice/v1';
const expectedUrl = 'https://web.webex.com/deviceAuth?usercode%3D123456%26oauthhelper%3Dhttps%3A%2F%2Foauth-helper-a.wbx2.com%2Fhelperservice%2Fv1';
const expectedUrl = 'https://web.webex.com/deviceAuth?usercode=123456&oauthhelper=https%3A%2F%2Foauth-helper-a.wbx2.com%2Fhelperservice%2Fv1';

const webex = makeWebex('http://example.com');

Expand All @@ -473,20 +473,6 @@ describe('plugin-authorization-browser-first-party', () => {

oauthHelperSpy.restore();
});

it('should return the original verificationUrl when it is an empty string', () => {
const verificationUrl = '';
const webex = makeWebex('http://example.com');

const oauthHelperSpy = sinon.stub(webex.internal.services, 'get');
const result = webex.authorization._generateQRCodeVerificationUrl(verificationUrl);

assert.notCalled(oauthHelperSpy);
assert.equal(result, verificationUrl);

oauthHelperSpy.restore();
});

});

describe('#initQRCodeLogin()', () => {
Expand Down

0 comments on commit ae9424d

Please sign in to comment.