Skip to content

Commit

Permalink
Change tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephanie Roy committed May 23, 2023
1 parent ac55156 commit 820c3bb
Showing 1 changed file with 14 additions and 21 deletions.
35 changes: 14 additions & 21 deletions extension/src/test/suite/experiments/data/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ import {
InternalCommands
} from '../../../../commands/internal'
import { buildExperimentsData } from '../util'
import { DEFAULT_NUM_OF_COMMITS_TO_SHOW } from '../../../../cli/dvc/constants'
import {
DEFAULT_NUM_OF_COMMITS_TO_SHOW,
ExperimentFlag
} from '../../../../cli/dvc/constants'
import { EXPERIMENTS_GIT_LOGS_REFS } from '../../../../experiments/data/constants'
import { gitPath } from '../../../../cli/git/constants'
import * as FileSystem from '../../../../fileSystem'
Expand Down Expand Up @@ -184,24 +187,6 @@ suite('Experiments Data Test Suite', () => {
expect(managedUpdateSpy).to.be.called
}).timeout(10000)

it('should call exp show for each branch to show', async () => {
stub(ExperimentsData.prototype, 'managedUpdate').resolves()
const branchesToShow = [
'main',
'my-other-branch',
'secret-branch',
'old-branch'
]
const { data, mockExpShow, mockGetBranchesToShow } =
buildExperimentsData(disposable)

mockGetBranchesToShow.returns(branchesToShow)

await data.update()

expect(mockExpShow).to.have.callCount(branchesToShow.length)
})

it('should prune any old branches to show before calling exp show on them', async () => {
stub(ExperimentsData.prototype, 'managedUpdate').resolves()
const branchesToShow = [
Expand All @@ -226,11 +211,19 @@ suite('Experiments Data Test Suite', () => {
'branch-283498'
)

mockGetBranchesToShow.returns(['main'])
mockGetBranchesToShow.returns([])

await data.update()

expect(mockExpShow).to.have.callCount(2)
expect(mockExpShow).to.have.been.calledWithMatch(
dvcDemoPath,
ExperimentFlag.REV,
'branch-283498~0',
ExperimentFlag.REV,
'branch-283498~1',
ExperimentFlag.REV,
'branch-283498~2'
)
})
})
})

0 comments on commit 820c3bb

Please sign in to comment.