File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed
extension/src/test/suite/experiments Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -344,6 +344,30 @@ suite('Experiments Test Suite', () => {
344344 return { experiments, experimentsModel, mockExecuteCommand }
345345 }
346346
347+ it ( 'should be able to handle a message to hide a table column' , async ( ) => {
348+ const { experiments, columnsModel } = buildExperiments ( disposable )
349+
350+ const mockToggleStatus = stub ( columnsModel , 'toggleStatus' )
351+ const mockSendTelemetryEvent = stub ( Telemetry , 'sendTelemetryEvent' )
352+ const webview = await experiments . showWebview ( )
353+ const mockMessageReceived = getMessageReceivedEmitter ( webview )
354+ const mockColumnId = 'mock-column-id'
355+
356+ mockMessageReceived . fire ( {
357+ payload : mockColumnId ,
358+ type : MessageFromWebviewType . HIDE_EXPERIMENTS_TABLE_COLUMN
359+ } )
360+
361+ expect ( mockToggleStatus ) . to . be . calledOnce
362+ expect ( mockToggleStatus ) . to . be . calledWithExactly ( mockColumnId )
363+
364+ expect ( mockSendTelemetryEvent ) . to . be . calledWithExactly (
365+ EventName . VIEWS_EXPERIMENTS_TABLE_HIDE_COLUMN ,
366+ { path : mockColumnId } ,
367+ undefined
368+ )
369+ } )
370+
347371 it ( 'should be able to handle a message to apply an experiment to workspace' , async ( ) => {
348372 const { experiments, mockExecuteCommand } =
349373 setupExperimentsAndMockCommands ( )
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ import { CheckpointsModel } from '../../../experiments/checkpoints/model'
1919import { FileSystemData } from '../../../fileSystem/data'
2020import * as Watcher from '../../../fileSystem/watcher'
2121import { ExperimentsModel } from '../../../experiments/model'
22+ import { ColumnsModel } from '../../../experiments/columns/model'
2223
2324const hasCheckpoints = ( data : ExperimentsOutput ) => {
2425 const [ experimentsWithBaseline ] = Object . values ( omit ( data , 'workspace' ) )
@@ -73,6 +74,8 @@ export const buildExperiments = (
7374 cliExecutor,
7475 cliReader,
7576 cliRunner,
77+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
78+ columnsModel : ( experiments as any ) . columns as ColumnsModel ,
7679 experiments,
7780 // eslint-disable-next-line @typescript-eslint/no-explicit-any
7881 experimentsModel : ( experiments as any ) . experiments as ExperimentsModel ,
You can’t perform that action at this time.
0 commit comments