Loading src/__mocks__/vscode.js +1 −1 Original line number Diff line number Diff line Loading @@ -34,7 +34,7 @@ module.exports = { createStatusBarItem: jest.fn(), showInputBox: jest.fn(), showQuickPick: jest.fn(), withProgress: jest.fn(), withProgress: jest.fn().mockImplementation((opt, callback) => callback()), createQuickPick: jest.fn(), }, commands: { Loading src/accounts/oauth/gitlab_authentication_provider.test.ts +7 −0 Original line number Diff line number Diff line Loading @@ -91,6 +91,13 @@ describe('GitLabAuthenticationProvider', () => { expect(session.accessToken).toEqual('test_token'); expect(session.scopes).toEqual(['read_user', 'api']); expect(accountService.getAllAccounts()).toHaveLength(1); expect(vscode.window.withProgress).toHaveBeenCalledWith( { title: 'Waiting for OAuth redirect from GitLab.com.', location: vscode.ProgressLocation.Notification, }, expect.any(Function), ); }); }); Loading src/accounts/oauth/gitlab_authentication_provider.ts +9 −2 Original line number Diff line number Diff line Loading @@ -115,7 +115,13 @@ export class GitLabAuthenticationProvider implements vscode.AuthenticationProvid this.exchangeCodeForToken(state, scopes), ); await openUrl(url); const account = await Promise.race([ const account = await vscode.window.withProgress( { title: 'Waiting for OAuth redirect from GitLab.com.', location: vscode.ProgressLocation.Notification, }, () => Promise.race([ receivedRedirectUrl, new Promise<OAuthAccount>((_, reject) => { setTimeout( Loading @@ -126,7 +132,8 @@ export class GitLabAuthenticationProvider implements vscode.AuthenticationProvid ]).finally(() => { delete this.#requestsInProgress[state]; cancelWaitingForRedirectUrl.fire(); }); }), ); return convertAccountToAuthenticationSession(account); } Loading Loading
src/__mocks__/vscode.js +1 −1 Original line number Diff line number Diff line Loading @@ -34,7 +34,7 @@ module.exports = { createStatusBarItem: jest.fn(), showInputBox: jest.fn(), showQuickPick: jest.fn(), withProgress: jest.fn(), withProgress: jest.fn().mockImplementation((opt, callback) => callback()), createQuickPick: jest.fn(), }, commands: { Loading
src/accounts/oauth/gitlab_authentication_provider.test.ts +7 −0 Original line number Diff line number Diff line Loading @@ -91,6 +91,13 @@ describe('GitLabAuthenticationProvider', () => { expect(session.accessToken).toEqual('test_token'); expect(session.scopes).toEqual(['read_user', 'api']); expect(accountService.getAllAccounts()).toHaveLength(1); expect(vscode.window.withProgress).toHaveBeenCalledWith( { title: 'Waiting for OAuth redirect from GitLab.com.', location: vscode.ProgressLocation.Notification, }, expect.any(Function), ); }); }); Loading
src/accounts/oauth/gitlab_authentication_provider.ts +9 −2 Original line number Diff line number Diff line Loading @@ -115,7 +115,13 @@ export class GitLabAuthenticationProvider implements vscode.AuthenticationProvid this.exchangeCodeForToken(state, scopes), ); await openUrl(url); const account = await Promise.race([ const account = await vscode.window.withProgress( { title: 'Waiting for OAuth redirect from GitLab.com.', location: vscode.ProgressLocation.Notification, }, () => Promise.race([ receivedRedirectUrl, new Promise<OAuthAccount>((_, reject) => { setTimeout( Loading @@ -126,7 +132,8 @@ export class GitLabAuthenticationProvider implements vscode.AuthenticationProvid ]).finally(() => { delete this.#requestsInProgress[state]; cancelWaitingForRedirectUrl.fire(); }); }), ); return convertAccountToAuthenticationSession(account); } Loading