Skip to content

Commit

Permalink
Improve max table depth test (#2621)
Browse files Browse the repository at this point in the history
* Improve max table depth test
* use ConfigKey variable for config name
* reset workspace configuration with an after hook
* delete unneeded await
  • Loading branch information
julieg18 authored Oct 18, 2022
1 parent abf4cd4 commit de41605
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions extension/src/test/suite/experiments/index.test.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
)

Expand All @@ -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(
Expand Down

0 comments on commit de41605

Please sign in to comment.