From 8f0c27ecc91779af16a50781c9a44165902b9577 Mon Sep 17 00:00:00 2001 From: julieg18 Date: Tue, 18 Oct 2022 12:05:29 -0500 Subject: [PATCH 1/3] 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 | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/extension/src/test/suite/experiments/index.test.ts b/extension/src/test/suite/experiments/index.test.ts index 6a28d39d5b..7efe20ec38 100644 --- a/extension/src/test/suite/experiments/index.test.ts +++ b/extension/src/test/suite/experiments/index.test.ts @@ -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( From b5de4ba440346a16dc3ae35f040823c9f5d104e9 Mon Sep 17 00:00:00 2001 From: julieg18 Date: Tue, 18 Oct 2022 16:17:58 -0500 Subject: [PATCH 2/3] Move from after to afterEach --- extension/src/test/suite/experiments/index.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extension/src/test/suite/experiments/index.test.ts b/extension/src/test/suite/experiments/index.test.ts index 7efe20ec38..64bf31b914 100644 --- a/extension/src/test/suite/experiments/index.test.ts +++ b/extension/src/test/suite/experiments/index.test.ts @@ -173,7 +173,7 @@ suite('Experiments Test Suite', () => { }) describe('handleMessageFromWebview', () => { - after(() => { + afterEach(() => { workspace .getConfiguration(ConfigKey.EXP_TABLE_HEAD_MAX_DEPTH) .update('', undefined, false) From a2299a49f1fbca84f6ec3af9f2ffba4c6c674bb7 Mon Sep 17 00:00:00 2001 From: julieg18 Date: Tue, 18 Oct 2022 16:52:39 -0500 Subject: [PATCH 3/3] Add missing import --- extension/src/test/suite/experiments/index.test.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extension/src/test/suite/experiments/index.test.ts b/extension/src/test/suite/experiments/index.test.ts index 64bf31b914..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 { @@ -173,7 +173,7 @@ suite('Experiments Test Suite', () => { }) describe('handleMessageFromWebview', () => { - afterEach(() => { + after(() => { workspace .getConfiguration(ConfigKey.EXP_TABLE_HEAD_MAX_DEPTH) .update('', undefined, false)