Skip to content

Commit

Permalink
Update prototype stub (#3355)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattseddon authored Feb 27, 2023
1 parent debcdce commit 8920d4c
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions extension/src/test/suite/extension.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,9 @@ suite('Extension Test Suite', () => {
onDidDelete: () => mockDisposable
})

const mockGetDvcRoots = stub(Setup.prototype, 'getRoots').returns([
dvcDemoPath
])

const mockCanRunCli = stub(DvcReader.prototype, 'version')
.onFirstCall()
.resolves(MIN_CLI_VERSION)
.onSecondCall()
.rejects('CLI is gone, dispose of everything')

mockCanRunCli.resolves(MIN_CLI_VERSION)

const mockDisposer = stub(Disposer, 'reset')

Expand Down Expand Up @@ -169,7 +163,7 @@ suite('Extension Test Suite', () => {

const mockPath = resolve('path', 'to', 'venv')

void (await setConfigValue(ConfigKey.PYTHON_PATH, mockPath))
await setConfigValue(ConfigKey.PYTHON_PATH, mockPath)

await Promise.all([
firstDisposal,
Expand All @@ -193,7 +187,6 @@ suite('Extension Test Suite', () => {
.been.called
expect(mockPlotsDiff, 'should have updated the plots data').to.have.been
.called
expect(mockGetDvcRoots).to.have.been.called

expect(
mockSendTelemetryEvent,
Expand Down Expand Up @@ -228,10 +221,13 @@ suite('Extension Test Suite', () => {
await workspaceExperimentsAreReady
const secondDisposal = disposalEvent()

void (await setConfigValue(
mockCanRunCli.resetBehavior()
mockCanRunCli.rejects('CLI is gone, dispose of everything')

await setConfigValue(
ConfigKey.PYTHON_PATH,
resolve('path', 'to', 'virtualenv')
))
)

await secondDisposal

Expand Down

0 comments on commit 8920d4c

Please sign in to comment.