Skip to content

Commit

Permalink
Remove Studio data request failed Toast (#5125)
Browse files Browse the repository at this point in the history
  • Loading branch information
julieg18 authored Dec 15, 2023
1 parent 0e6c5be commit f674240
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 43 deletions.
4 changes: 0 additions & 4 deletions extension/src/experiments/data/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import { COMMITS_SEPARATOR, gitPath } from '../../cli/git/constants'
import { getGitPath } from '../../fileSystem'
import { ExperimentsModel } from '../model'
import { Studio } from '../studio'
import { Toast } from '../../vscode/toast'

export class ExperimentsData extends BaseData<ExperimentsOutput> {
private readonly experiments: ExperimentsModel
Expand Down Expand Up @@ -157,9 +156,6 @@ export class ExperimentsData extends BaseData<ExperimentsOutput> {
})
} catch {
this.notifyChanged(defaultData)
void Toast.showError(
`Unable to fetch data from [Studio](${this.studio.getInstanceUrl()}).`
)
}
}

Expand Down
39 changes: 0 additions & 39 deletions extension/src/test/suite/experiments/data/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import {
} from '../../../../data'
import { Studio } from '../../../../experiments/studio'
import { DEFAULT_STUDIO_URL } from '../../../../setup/webview/contract'
import { Toast } from '../../../../vscode/toast'

const MOCK_WORKSPACE_GIT_FOLDER = join(dvcDemoPath, '.mock-git')

Expand Down Expand Up @@ -410,43 +409,5 @@ suite('Experiments Data Test Suite', () => {
}
)
})

it('should show a toast if the request to Studio fails', async () => {
const mockStudioToken = 'isat_BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB'
const mockSelfHostedStudioUrl = 'https://studio.example.com'
const { data, mockFetch } = buildExperimentsData(
disposable,
'* main',
gitLogFixture,
mockStudioToken,
mockSelfHostedStudioUrl
)
const mockToast = stub(Toast, 'showError')

mockFetch.onFirstCall().callsFake(() => {
throw new Error('request failed')
})

const requestSent = new Promise(resolve =>
data.onDidUpdate(data => {
if (isStudioExperimentsOutput(data)) {
resolve(undefined)
expect(data).to.deep.equal({
live: [],
pushed: [],
view_url: mockBaseStudioUrl
})
}
})
)

await data.isReady()

await requestSent

expect(mockToast).to.be.calledWithExactly(
`Unable to fetch data from [Studio](${mockSelfHostedStudioUrl}).`
)
})
})
})

0 comments on commit f674240

Please sign in to comment.