Skip to content

Commit e0306c7

Browse files
committed
fixing more jedi tests
1 parent a80b060 commit e0306c7

File tree

1 file changed

+39
-3
lines changed

1 file changed

+39
-3
lines changed

src/test/languageServer/watcher.unit.test.ts

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
IExperimentService,
1515
IExtensions,
1616
IInterpreterPathService,
17+
ILogOutputChannel,
1718
} from '../../client/common/types';
1819
import { LanguageService } from '../../client/common/utils/localize';
1920
import { IEnvironmentVariablesProvider } from '../../client/common/variables/types';
@@ -438,8 +439,26 @@ suite('Language server watcher', () => {
438439
getSettings: getSettingsStub,
439440
} as unknown) as IConfigurationService;
440441

442+
// Create a mock ILogOutputChannel
443+
const mockOutputChannel = {} as ILogOutputChannel;
444+
445+
// Create a mock IApplicationShell with createOutputChannel method
446+
const mockApplicationShell = ({
447+
createOutputChannel: () => mockOutputChannel,
448+
} as unknown) as IApplicationShell;
449+
450+
// Create a mock service container with the required get method
451+
const mockServiceContainer = {
452+
get: (serviceIdentifier: any) => {
453+
if (serviceIdentifier === IApplicationShell) {
454+
return mockApplicationShell;
455+
}
456+
return undefined;
457+
},
458+
} as IServiceContainer;
459+
441460
watcher = new LanguageServerWatcher(
442-
{} as IServiceContainer,
461+
mockServiceContainer,
443462

444463
configService,
445464
{} as IExperimentService,
@@ -634,9 +653,26 @@ suite('Language server watcher', () => {
634653
const stopLanguageServerStub = sandbox.stub(extensionLSCls.prototype, 'stopLanguageServer');
635654
sandbox.stub(extensionLSCls.prototype, 'canStartLanguageServer').returns(true);
636655

637-
watcher = new LanguageServerWatcher(
638-
{} as IServiceContainer,
656+
// Create a mock ILogOutputChannel
657+
const mockOutputChannel = {} as ILogOutputChannel;
639658

659+
// Create a mock IApplicationShell with createOutputChannel method
660+
const mockApplicationShell = ({
661+
createOutputChannel: () => mockOutputChannel,
662+
} as unknown) as IApplicationShell;
663+
664+
// Create a mock service container with the required get method
665+
const mockServiceContainer = {
666+
get: (serviceIdentifier: any) => {
667+
if (serviceIdentifier === IApplicationShell) {
668+
return mockApplicationShell;
669+
}
670+
return undefined;
671+
},
672+
} as IServiceContainer;
673+
674+
watcher = new LanguageServerWatcher(
675+
mockServiceContainer,
640676
{
641677
getSettings: () => ({ languageServer }),
642678
} as IConfigurationService,

0 commit comments

Comments
 (0)