@@ -8,9 +8,7 @@ import { anything, instance, mock, verify, when } from 'ts-mockito';
88import { Disposable } from 'vscode' ;
99import { CommandManager } from '../../client/common/application/commandManager' ;
1010import { ICommandManager } from '../../client/common/application/types' ;
11- import { AlwaysDisplayTestExplorerGroups } from '../../client/common/experiments/groups' ;
12- import { ExperimentsManager } from '../../client/common/experiments/manager' ;
13- import { IDisposableRegistry , IExperimentsManager } from '../../client/common/types' ;
11+ import { IDisposableRegistry } from '../../client/common/types' ;
1412import { ServiceContainer } from '../../client/ioc/container' ;
1513import { IServiceContainer } from '../../client/ioc/types' ;
1614import { JediSymbolProvider } from '../../client/providers/symbolProvider' ;
@@ -20,7 +18,6 @@ suite('Unit Tests - ManagementService', () => {
2018 suite ( 'Experiments' , ( ) => {
2119 let serviceContainer : IServiceContainer ;
2220 let sandbox : sinon . SinonSandbox ;
23- let experiment : IExperimentsManager ;
2421 let commandManager : ICommandManager ;
2522 let testManagementService : UnitTestManagementService ;
2623 setup ( ( ) => {
@@ -32,11 +29,9 @@ suite('Unit Tests - ManagementService', () => {
3229 sandbox . stub ( UnitTestManagementService . prototype , 'registerHandlers' ) ;
3330 sandbox . stub ( UnitTestManagementService . prototype , 'autoDiscoverTests' ) . callsFake ( ( ) => Promise . resolve ( ) ) ;
3431
35- experiment = mock ( ExperimentsManager ) ;
3632 commandManager = mock ( CommandManager ) ;
3733
3834 when ( serviceContainer . get < Disposable [ ] > ( IDisposableRegistry ) ) . thenReturn ( [ ] ) ;
39- when ( serviceContainer . get < IExperimentsManager > ( IExperimentsManager ) ) . thenReturn ( instance ( experiment ) ) ;
4035 when ( serviceContainer . get < ICommandManager > ( ICommandManager ) ) . thenReturn ( instance ( commandManager ) ) ;
4136 when ( commandManager . executeCommand ( anything ( ) , anything ( ) , anything ( ) ) ) . thenResolve ( ) ;
4237
@@ -46,25 +41,10 @@ suite('Unit Tests - ManagementService', () => {
4641 sandbox . restore ( ) ;
4742 } ) ;
4843
49- test ( 'Execute command if in experiment' , async ( ) => {
50- when ( experiment . inExperiment ( AlwaysDisplayTestExplorerGroups . experiment ) ) . thenReturn ( true ) ;
51-
52- await testManagementService . activate ( instance ( mock ( JediSymbolProvider ) ) ) ;
53-
54- verify ( commandManager . executeCommand ( 'setContext' , 'testsDiscovered' , true ) ) . once ( ) ;
55- verify ( experiment . inExperiment ( AlwaysDisplayTestExplorerGroups . experiment ) ) . once ( ) ;
56- verify ( experiment . inExperiment ( AlwaysDisplayTestExplorerGroups . control ) ) . never ( ) ;
57- verify ( experiment . sendTelemetryIfInExperiment ( anything ( ) ) ) . never ( ) ;
58- } ) ;
59- test ( 'If not in experiment, check and send Telemetry for control group and do not execute command' , async ( ) => {
60- when ( experiment . inExperiment ( AlwaysDisplayTestExplorerGroups . experiment ) ) . thenReturn ( false ) ;
61-
44+ test ( 'Do not execute command' , async ( ) => {
6245 await testManagementService . activate ( instance ( mock ( JediSymbolProvider ) ) ) ;
6346
6447 verify ( commandManager . executeCommand ( 'setContext' , 'testsDiscovered' , anything ( ) ) ) . never ( ) ;
65- verify ( experiment . inExperiment ( AlwaysDisplayTestExplorerGroups . experiment ) ) . once ( ) ;
66- verify ( experiment . inExperiment ( AlwaysDisplayTestExplorerGroups . control ) ) . never ( ) ;
67- verify ( experiment . sendTelemetryIfInExperiment ( AlwaysDisplayTestExplorerGroups . control ) ) . once ( ) ;
6848 } ) ;
6949 } ) ;
7050} ) ;
0 commit comments