Skip to content

Commit 2c3836d

Browse files
committed
add dispose to mock
1 parent b45b140 commit 2c3836d

File tree

1 file changed

+75
-15
lines changed

1 file changed

+75
-15
lines changed

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

Lines changed: 75 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@ suite('Language server watcher', () => {
3636
setup(() => {
3737
disposables = [];
3838
// Create a mock ILogOutputChannel
39-
const mockOutputChannel = {} as ILogOutputChannel;
39+
const mockOutputChannel = {
40+
dispose: () => {
41+
/* do nothing */
42+
},
43+
} as ILogOutputChannel;
4044

4145
// Create a mock IApplicationShell with createOutputChannel method
4246
const mockApplicationShell = ({
@@ -108,7 +112,11 @@ suite('Language server watcher', () => {
108112

109113
test('The constructor should add a listener to onDidChange to the list of disposables if it is a trusted workspace', () => {
110114
// Create a mock ILogOutputChannel
111-
const mockOutputChannel = {} as ILogOutputChannel;
115+
const mockOutputChannel = {
116+
dispose: () => {
117+
/* do nothing */
118+
},
119+
} as ILogOutputChannel;
112120

113121
// Create a mock IApplicationShell with createOutputChannel method
114122
const mockApplicationShell = ({
@@ -171,7 +179,11 @@ suite('Language server watcher', () => {
171179

172180
test('The constructor should not add a listener to onDidChange to the list of disposables if it is not a trusted workspace', () => {
173181
// Create a mock ILogOutputChannel
174-
const mockOutputChannel = {} as ILogOutputChannel;
182+
const mockOutputChannel = {
183+
dispose: () => {
184+
/* do nothing */
185+
},
186+
} as ILogOutputChannel;
175187

176188
// Create a mock IApplicationShell with createOutputChannel method
177189
const mockApplicationShell = ({
@@ -255,7 +267,11 @@ suite('Language server watcher', () => {
255267
} as unknown) as IInterpreterService;
256268

257269
// Create a mock ILogOutputChannel
258-
const mockOutputChannel = {} as ILogOutputChannel;
270+
const mockOutputChannel = {
271+
dispose: () => {
272+
/* do nothing */
273+
},
274+
} as ILogOutputChannel;
259275

260276
// Create a mock IApplicationShell with createOutputChannel method
261277
const mockApplicationShell = ({
@@ -348,7 +364,11 @@ suite('Language server watcher', () => {
348364
});
349365

350366
// Create a mock ILogOutputChannel
351-
const mockOutputChannel = {} as ILogOutputChannel;
367+
const mockOutputChannel = {
368+
dispose: () => {
369+
/* do nothing */
370+
},
371+
} as ILogOutputChannel;
352372

353373
// Create a mock IApplicationShell with createOutputChannel method
354374
const mockApplicationShell = ({
@@ -453,7 +473,11 @@ suite('Language server watcher', () => {
453473
} as unknown) as IWorkspaceService;
454474

455475
// Create a mock ILogOutputChannel
456-
const mockOutputChannel = {} as ILogOutputChannel;
476+
const mockOutputChannel = {
477+
dispose: () => {
478+
/* do nothing */
479+
},
480+
} as ILogOutputChannel;
457481

458482
// Create a mock IApplicationShell with createOutputChannel method
459483
const mockApplicationShell = ({
@@ -542,7 +566,11 @@ suite('Language server watcher', () => {
542566
} as unknown) as IConfigurationService;
543567

544568
// Create a mock ILogOutputChannel
545-
const mockOutputChannel = {} as ILogOutputChannel;
569+
const mockOutputChannel = {
570+
dispose: () => {
571+
/* do nothing */
572+
},
573+
} as ILogOutputChannel;
546574

547575
// Create a mock IApplicationShell with createOutputChannel method
548576
const mockApplicationShell = ({
@@ -613,7 +641,11 @@ suite('Language server watcher', () => {
613641
startLanguageServerStub.returns(Promise.resolve());
614642

615643
// Create a mock ILogOutputChannel
616-
const mockOutputChannel = {} as ILogOutputChannel;
644+
const mockOutputChannel = {
645+
dispose: () => {
646+
/* do nothing */
647+
},
648+
} as ILogOutputChannel;
617649

618650
// Create a mock IApplicationShell with createOutputChannel method
619651
const mockApplicationShell = ({
@@ -687,7 +719,11 @@ suite('Language server watcher', () => {
687719
startLanguageServerStub.returns(Promise.resolve());
688720

689721
// Create a mock ILogOutputChannel
690-
const mockOutputChannel = {} as ILogOutputChannel;
722+
const mockOutputChannel = {
723+
dispose: () => {
724+
/* do nothing */
725+
},
726+
} as ILogOutputChannel;
691727

692728
// Create a mock IApplicationShell with createOutputChannel method
693729
const mockApplicationShell = ({
@@ -792,7 +828,11 @@ suite('Language server watcher', () => {
792828
sandbox.stub(extensionLSCls.prototype, 'canStartLanguageServer').returns(true);
793829

794830
// Create a mock ILogOutputChannel
795-
const mockOutputChannel = {} as ILogOutputChannel;
831+
const mockOutputChannel = {
832+
dispose: () => {
833+
/* do nothing */
834+
},
835+
} as ILogOutputChannel;
796836

797837
// Create a mock IApplicationShell with createOutputChannel method
798838
const mockApplicationShell = ({
@@ -897,7 +937,11 @@ suite('Language server watcher', () => {
897937
} as unknown) as IWorkspaceService;
898938

899939
// Create a mock ILogOutputChannel
900-
const mockOutputChannel = {} as ILogOutputChannel;
940+
const mockOutputChannel = {
941+
dispose: () => {
942+
/* do nothing */
943+
},
944+
} as ILogOutputChannel;
901945

902946
// Create a mock IApplicationShell with createOutputChannel method
903947
const mockApplicationShell = ({
@@ -993,7 +1037,11 @@ suite('Language server watcher', () => {
9931037
} as unknown) as IInterpreterService;
9941038

9951039
// Create a mock ILogOutputChannel
996-
const mockOutputChannel = {} as ILogOutputChannel;
1040+
const mockOutputChannel = {
1041+
dispose: () => {
1042+
/* do nothing */
1043+
},
1044+
} as ILogOutputChannel;
9971045

9981046
// Create a mock IApplicationShell with createOutputChannel method
9991047
const mockApplicationShell = ({
@@ -1087,7 +1135,11 @@ suite('Language server watcher', () => {
10871135
} as unknown) as IInterpreterService;
10881136

10891137
// Create a mock ILogOutputChannel
1090-
const mockOutputChannel = {} as ILogOutputChannel;
1138+
const mockOutputChannel = {
1139+
dispose: () => {
1140+
/* do nothing */
1141+
},
1142+
} as ILogOutputChannel;
10911143

10921144
// Create a mock IApplicationShell with createOutputChannel method
10931145
const mockApplicationShell = ({
@@ -1183,7 +1235,11 @@ suite('Language server watcher', () => {
11831235
} as unknown) as IInterpreterService;
11841236

11851237
// Create a mock ILogOutputChannel
1186-
const mockOutputChannel = {} as ILogOutputChannel;
1238+
const mockOutputChannel = {
1239+
dispose: () => {
1240+
/* do nothing */
1241+
},
1242+
} as ILogOutputChannel;
11871243

11881244
// Create a mock IApplicationShell with createOutputChannel method
11891245
const mockApplicationShell = ({
@@ -1280,7 +1336,11 @@ suite('Language server watcher', () => {
12801336
} as unknown) as IInterpreterService;
12811337

12821338
// Create a mock ILogOutputChannel
1283-
const mockOutputChannel = {} as ILogOutputChannel;
1339+
const mockOutputChannel = {
1340+
dispose: () => {
1341+
/* do nothing */
1342+
},
1343+
} as ILogOutputChannel;
12841344

12851345
// Create a mock IApplicationShell with createOutputChannel method
12861346
const mockApplicationShell = ({

0 commit comments

Comments
 (0)