Skip to content

Commit

Permalink
Add test for the Open-to-the-side message handler
Browse files Browse the repository at this point in the history
  • Loading branch information
wolmir committed May 30, 2022
1 parent dbecb40 commit 337bbbb
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion extension/src/test/suite/experiments/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import {
commands,
workspace,
Uri,
QuickPickItem
QuickPickItem,
ViewColumn
} from 'vscode'
import { buildExperiments } from './util'
import { Disposable } from '../../../extension'
Expand Down Expand Up @@ -390,6 +391,28 @@ suite('Experiments Test Suite', () => {
)
})

it('should be able to handle a message to open the source params file from a column path', async () => {
const { experiments } = setupExperimentsAndMockCommands()

const mockShowTextDocument = stub(window, 'showTextDocument')
const webview = await experiments.showWebview()
const mockMessageReceived = getMessageReceivedEmitter(webview)
const mockColumnId = 'params:params.yaml:lr'

mockMessageReceived.fire({
payload: mockColumnId,
type: MessageFromWebviewType.OPEN_PARAMS_FILE_TO_THE_SIDE
})

expect(mockShowTextDocument).to.be.calledOnce
expect(mockShowTextDocument).to.be.calledWithExactly(
Uri.file(join(dvcDemoPath, 'params.yaml')),
{
viewColumn: ViewColumn.Beside
}
)
})

it('should be able to handle a message to apply an experiment to workspace', async () => {
const { experiments, mockExecuteCommand } =
setupExperimentsAndMockCommands()
Expand Down

0 comments on commit 337bbbb

Please sign in to comment.