mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-21 17:19:01 +01:00
Have forceNewSession behave like createIfNone if no sessions are present (#148819)
* Have forceNewSession behave like createIfNone if no sessions are present * include note in vscode.d.ts about forceNewSesssion behavior
This commit is contained in:
committed by
GitHub
parent
9991dffebf
commit
6c8d8a2654
@@ -211,7 +211,7 @@ suite('ExtHostAuthentication', () => {
|
||||
assert.strictEqual(session.scopes[0], session2?.scopes[0]);
|
||||
});
|
||||
|
||||
test('forceNewSession - true', async () => {
|
||||
test('forceNewSession - true - existing session', async () => {
|
||||
const scopes = ['foo'];
|
||||
const session1 = await extHostAuthentication.getSession(
|
||||
extensionDescription,
|
||||
@@ -235,6 +235,20 @@ suite('ExtHostAuthentication', () => {
|
||||
assert.notStrictEqual(session1.accessToken, session2?.accessToken);
|
||||
});
|
||||
|
||||
// Should behave like createIfNone: true
|
||||
test('forceNewSession - true - no existing session', async () => {
|
||||
const scopes = ['foo'];
|
||||
const session = await extHostAuthentication.getSession(
|
||||
extensionDescription,
|
||||
'test',
|
||||
scopes,
|
||||
{
|
||||
forceNewSession: true
|
||||
});
|
||||
assert.strictEqual(session?.id, '1');
|
||||
assert.strictEqual(session?.scopes[0], 'foo');
|
||||
});
|
||||
|
||||
test('forceNewSession - detail', async () => {
|
||||
const scopes = ['foo'];
|
||||
const session1 = await extHostAuthentication.getSession(
|
||||
@@ -350,21 +364,6 @@ suite('ExtHostAuthentication', () => {
|
||||
|
||||
//#region error cases
|
||||
|
||||
test('forceNewSession with no sessions', async () => {
|
||||
try {
|
||||
await extHostAuthentication.getSession(
|
||||
extensionDescription,
|
||||
'test',
|
||||
['foo'],
|
||||
{
|
||||
forceNewSession: true
|
||||
});
|
||||
assert.fail('should have thrown an Error.');
|
||||
} catch (e) {
|
||||
assert.strictEqual(e.message, 'No existing sessions found.');
|
||||
}
|
||||
});
|
||||
|
||||
test('createIfNone and forceNewSession', async () => {
|
||||
try {
|
||||
await extHostAuthentication.getSession(
|
||||
|
||||
Reference in New Issue
Block a user