Path: blob/main/extensions/copilot/test/simulation/fixtures/edit/issue-release-142/testAuthProvider.ts
13405 views
import { AuthenticationForceNewSessionOptions, AuthenticationProvider, AuthenticationProviderAuthenticationSessionsChangeEvent, AuthenticationSession, Event, EventEmitter } from "vscode";12export class TestAuthProvider implements AuthenticationProvider {3private _onDidChangeSessions = new EventEmitter<AuthenticationProviderAuthenticationSessionsChangeEvent>();4onDidChangeSessions: Event<AuthenticationProviderAuthenticationSessionsChangeEvent> = this._onDidChangeSessions.event;56private _sessions: AuthenticationSession[] = [7{8id: "session1",9accessToken: "dummyToken1",10scopes: ["scope"],11account: { label: "Dummy Account 1", id: "dummyAccount1" }12},13{14id: "session2",15accessToken: "dummyToken2",16scopes: ["scope"],17account: { label: "Dummy Account 2", id: "dummyAccount2" }18}19];2021getSessions(scopes?: readonly string[] | undefined): Thenable<readonly AuthenticationSession[]> {22return Promise.resolve(this._sessions.filter(session => !scopes || scopes.every(scope => session.scopes.indexOf(scope) !== -1)));23}24createSession(scopes: readonly string[], options?: AuthenticationForceNewSessionOptions): Thenable<AuthenticationSession> {2526}27removeSession(sessionId: string): Thenable<void> {2829}30}313233