From de41605ea01871b962764b431ff438734e570ce7 Mon Sep 17 00:00:00 2001 From: Julie <43496356+julieg18@users.noreply.github.com> Date: Tue, 18 Oct 2022 17:31:21 -0500 Subject: [PATCH] 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 --- extension/src/test/suite/experiments/index.test.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/extension/src/test/suite/experiments/index.test.ts b/extension/src/test/suite/experiments/index.test.ts index 6a28d39d5b..aba912df13 100644 --- a/extension/src/test/suite/experiments/index.test.ts +++ b/extension/src/test/suite/experiments/index.test.ts @@ -1,5 +1,5 @@ import { join, resolve } from 'path' -import { afterEach, beforeEach, describe, it, suite } from 'mocha' +import { after, afterEach, beforeEach, describe, it, suite } from 'mocha' import { expect } from 'chai' import { stub, spy, restore, SinonStub } from 'sinon' import { @@ -67,6 +67,7 @@ import { shortenForLabel } from '../../../util/string' import { GitExecutor } from '../../../cli/git/executor' import { WorkspacePlots } from '../../../plots/workspace' import { RegisteredCommands } from '../../../commands/external' +import { ConfigKey } from '../../../vscode/config' suite('Experiments Test Suite', () => { const disposable = Disposable.fn() @@ -172,6 +173,12 @@ suite('Experiments Test Suite', () => { }) describe('handleMessageFromWebview', () => { + after(() => { + workspace + .getConfiguration(ConfigKey.EXP_TABLE_HEAD_MAX_DEPTH) + .update('', undefined, false) + }) + const setupExperimentsAndMockCommands = () => { const { columnsModel, @@ -883,9 +890,8 @@ suite('Experiments Test Suite', () => { it('should be able to handle a message to update the table depth', async () => { const { experiments } = buildExperiments(disposable, expShowFixture) const inputEvent = getInputBoxEvent('0') - const tableMaxDepthOption = 'dvc.experimentsTableHeadMaxHeight' const tableMaxDepthChanged = configurationChangeEvent( - tableMaxDepthOption, + ConfigKey.EXP_TABLE_HEAD_MAX_DEPTH, disposable ) @@ -901,7 +907,7 @@ suite('Experiments Test Suite', () => { await tableMaxDepthChanged expect( - await workspace.getConfiguration().get(tableMaxDepthOption) + workspace.getConfiguration().get(ConfigKey.EXP_TABLE_HEAD_MAX_DEPTH) ).to.equal(0) expect(mockSendTelemetryEvent).to.be.called expect(