-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ed9dabd
commit 8360e23
Showing
47 changed files
with
1,033 additions
and
241 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import * as assert from 'node:assert'; | ||
import sinon from 'sinon'; | ||
|
||
import * as vscode from 'vscode'; | ||
import { randomUUID } from 'node:crypto'; | ||
import { WelcomeViewSignIn } from './welcome-view-sign-in'; | ||
|
||
suite('The WelcomViewSignInCommand', () => { | ||
let getSessionStub: sinon.SinonStub; | ||
let showErrorMessageStub: sinon.SinonStub; | ||
|
||
const sessionObject = { | ||
account: { | ||
id: 'Heroku', | ||
label: 'tester-123@heroku.com' | ||
}, | ||
id: randomUUID(), | ||
scopes: [], | ||
accessToken: randomUUID() | ||
}; | ||
setup(() => { | ||
getSessionStub = sinon.stub(vscode.authentication, 'getSession'); | ||
showErrorMessageStub = sinon.stub(vscode.window, 'showErrorMessage'); | ||
}); | ||
|
||
teardown(() => { | ||
getSessionStub.restore(); | ||
showErrorMessageStub.restore(); | ||
}); | ||
|
||
test('is registered', async () => { | ||
const commands = await vscode.commands.getCommands(true); | ||
const command = commands.find(command => command === WelcomeViewSignIn.COMMAND_ID); | ||
assert.ok(!!command, 'The WelcomeViewSignIn command is not registered'); | ||
}); | ||
|
||
test('successfully authenticates', async () => { | ||
getSessionStub.callsFake(async (providerId: string) => { | ||
if (providerId === 'heroku:auth:login') { | ||
return sessionObject; | ||
} | ||
return undefined; | ||
}); | ||
await vscode.commands.executeCommand<string>(WelcomeViewSignIn.COMMAND_ID); | ||
assert.ok(!!getSessionStub.exceptions.length); | ||
}); | ||
|
||
test('asks the user to try again when authentication fails', async() => { | ||
showErrorMessageStub.callsFake(async () => 'skip'); | ||
getSessionStub.throws(new Error('failed!')); | ||
const result = await vscode.commands.executeCommand<string>(WelcomeViewSignIn.COMMAND_ID); | ||
assert.ok(showErrorMessageStub.called); | ||
}) | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.