66import { assert } from 'chai' ;
77import { afterEach , beforeEach , suite , test } from 'vitest' ;
88import * as vscode from 'vscode' ;
9- import { IAuthenticationService } from '../../../../platform/authentication/common/authentication' ;
109import { IFileSystemService } from '../../../../platform/filesystem/common/fileSystemService' ;
1110import { FileType } from '../../../../platform/filesystem/common/fileTypes' ;
1211import { MockFileSystemService } from '../../../../platform/filesystem/node/test/mockFileSystemService' ;
1312import { CustomAgentDetails , CustomAgentListItem , CustomAgentListOptions , IOctoKitService } from '../../../../platform/github/common/githubService' ;
1413import { ILogService } from '../../../../platform/log/common/logService' ;
15- import { Emitter } from '../../../../util/vs/base/common/event' ;
1614import { DisposableStore } from '../../../../util/vs/base/common/lifecycle' ;
1715import { URI } from '../../../../util/vs/base/common/uri' ;
1816import { createExtensionUnitTestingServices } from '../../../test/node/services' ;
1917import { OrganizationAndEnterpriseAgentProvider } from '../organizationAndEnterpriseAgentProvider' ;
2018
21- class MockAuthenticationService implements IAuthenticationService {
22- _serviceBrand : undefined ;
23- private readonly _onDidAuthenticationChange = new Emitter < void > ( ) ;
24- readonly onDidAuthenticationChange = this . _onDidAuthenticationChange . event ;
25- readonly onDidAccessTokenChange = new Emitter < void > ( ) . event ;
26- readonly anyGitHubSession : vscode . AuthenticationSession | undefined ;
27-
28- readonly isMinimalMode = false ;
29- readonly permissiveGitHubSession : vscode . AuthenticationSession | undefined ;
30- speculativeDecodingEndpointToken : string | undefined ;
31- readonly onDidAdoAuthenticationChange = new Emitter < void > ( ) . event ;
32-
33- async getAnyGitHubSession ( options ?: vscode . AuthenticationGetSessionOptions ) : Promise < vscode . AuthenticationSession | undefined > {
34- return undefined ;
35- }
36- async getPermissiveGitHubSession ( options : vscode . AuthenticationGetSessionOptions ) : Promise < vscode . AuthenticationSession | undefined > {
37- return undefined ;
38- }
39- readonly copilotToken = undefined ;
40- async getCopilotToken ( forceRefresh ?: boolean ) : Promise < any > {
41- return undefined ;
42- }
43-
44- resetCopilotToken ( httpError ?: number ) : void {
45- // no-op
46- }
47-
48- async getAdoAccessTokenBase64 ( options ?: vscode . AuthenticationGetSessionOptions ) : Promise < string | undefined > {
49- return undefined ;
50- }
51-
52- fireOnDidAuthenticationChange ( ) {
53- this . _onDidAuthenticationChange . fire ( ) ;
54- }
55- }
56-
5719/**
5820 * Mock implementation of IOctoKitService for testing
5921 */
@@ -124,7 +86,6 @@ suite('OrganizationAndEnterpriseAgentProvider', () => {
12486 let mockOctoKitService : MockOctoKitService ;
12587 let mockFileSystem : MockFileSystemService ;
12688 let mockExtensionContext : MockExtensionContext ;
127- let mockAuthenticationService : MockAuthenticationService ;
12889 let accessor : any ;
12990 let provider : OrganizationAndEnterpriseAgentProvider ;
13091
@@ -133,7 +94,6 @@ suite('OrganizationAndEnterpriseAgentProvider', () => {
13394
13495 // Create mocks first
13596 mockOctoKitService = new MockOctoKitService ( ) ;
136- mockAuthenticationService = new MockAuthenticationService ( ) ;
13797 const storageUri = URI . file ( '/test/storage' ) ;
13898 mockExtensionContext = new MockExtensionContext ( storageUri ) ;
13999
@@ -156,7 +116,6 @@ suite('OrganizationAndEnterpriseAgentProvider', () => {
156116 accessor . get ( ILogService ) ,
157117 mockExtensionContext as any ,
158118 mockFileSystem ,
159- mockAuthenticationService
160119 ) ;
161120 disposables . add ( provider ) ;
162121 return provider ;
@@ -940,16 +899,4 @@ Test prompt
940899 // Should have aborted after first org, so second org shouldn't be processed
941900 assert . equal ( callCount , 1 ) ;
942901 } ) ;
943-
944- test ( 'fires change event when authentication state changes' , async ( ) => {
945- const provider = createProvider ( ) ;
946- let eventFired = false ;
947- provider . onDidChangeCustomAgents ( ( ) => {
948- eventFired = true ;
949- } ) ;
950-
951- mockAuthenticationService . fireOnDidAuthenticationChange ( ) ;
952-
953- assert . equal ( eventFired , true ) ;
954- } ) ;
955902} ) ;
0 commit comments