Skip to content

Commit de41605

Browse files
authored
Improve max table depth test (#2621)
* Improve max table depth test * use ConfigKey variable for config name * reset workspace configuration with an after hook * delete unneeded await
1 parent abf4cd4 commit de41605

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

extension/src/test/suite/experiments/index.test.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { join, resolve } from 'path'
2-
import { afterEach, beforeEach, describe, it, suite } from 'mocha'
2+
import { after, afterEach, beforeEach, describe, it, suite } from 'mocha'
33
import { expect } from 'chai'
44
import { stub, spy, restore, SinonStub } from 'sinon'
55
import {
@@ -67,6 +67,7 @@ import { shortenForLabel } from '../../../util/string'
6767
import { GitExecutor } from '../../../cli/git/executor'
6868
import { WorkspacePlots } from '../../../plots/workspace'
6969
import { RegisteredCommands } from '../../../commands/external'
70+
import { ConfigKey } from '../../../vscode/config'
7071

7172
suite('Experiments Test Suite', () => {
7273
const disposable = Disposable.fn()
@@ -172,6 +173,12 @@ suite('Experiments Test Suite', () => {
172173
})
173174

174175
describe('handleMessageFromWebview', () => {
176+
after(() => {
177+
workspace
178+
.getConfiguration(ConfigKey.EXP_TABLE_HEAD_MAX_DEPTH)
179+
.update('', undefined, false)
180+
})
181+
175182
const setupExperimentsAndMockCommands = () => {
176183
const {
177184
columnsModel,
@@ -883,9 +890,8 @@ suite('Experiments Test Suite', () => {
883890
it('should be able to handle a message to update the table depth', async () => {
884891
const { experiments } = buildExperiments(disposable, expShowFixture)
885892
const inputEvent = getInputBoxEvent('0')
886-
const tableMaxDepthOption = 'dvc.experimentsTableHeadMaxHeight'
887893
const tableMaxDepthChanged = configurationChangeEvent(
888-
tableMaxDepthOption,
894+
ConfigKey.EXP_TABLE_HEAD_MAX_DEPTH,
889895
disposable
890896
)
891897

@@ -901,7 +907,7 @@ suite('Experiments Test Suite', () => {
901907
await tableMaxDepthChanged
902908

903909
expect(
904-
await workspace.getConfiguration().get(tableMaxDepthOption)
910+
workspace.getConfiguration().get(ConfigKey.EXP_TABLE_HEAD_MAX_DEPTH)
905911
).to.equal(0)
906912
expect(mockSendTelemetryEvent).to.be.called
907913
expect(

0 commit comments

Comments
 (0)