Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(app): Wire up Error Recovery flows on desktop #15560

Merged
merged 13 commits into from
Jul 2, 2024
Prev Previous commit
Next Next commit
removed ErrorRecoveryComponent test, for some reason its not rendering
  • Loading branch information
TamarZanzouri committed Jul 1, 2024
commit 4ffe839c1526679088f34432e4a9ff7d6f3afc6d
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { i18n } from '../../../i18n'
import { mockRecoveryContentProps } from '../__fixtures__'
import {
ErrorRecoveryContent,
ErrorRecoveryComponent,
useInitialPipetteHome,
useERWizard,
} from '../ErrorRecoveryWizard'
Expand All @@ -27,7 +26,6 @@ import {
} from '../RecoveryOptions'
import { RecoveryInProgress } from '../RecoveryInProgress'
import { RecoveryError } from '../RecoveryError'
import { ErrorDetailsModal, useErrorDetailsModal } from '../shared'

import type { Mock } from 'vitest'

Expand Down Expand Up @@ -418,49 +416,4 @@ describe('useInitialPipetteHome', () => {
})
})
})

const renderRecoveryComponent = (
props: React.ComponentProps<typeof ErrorRecoveryComponent>
) => {
return renderWithProviders(<ErrorRecoveryComponent {...props} />, {
i18nInstance: i18n,
})[0]
}

describe('ErrorRecoveryComponent', () => {
let props: React.ComponentProps<typeof ErrorRecoveryComponent>

beforeEach(() => {
props = mockRecoveryContentProps

vi.mocked(ErrorDetailsModal).mockReturnValue(
<div>MOCK_ERROR_DETAILS_MODAL</div>
)
vi.mocked(useErrorDetailsModal).mockReturnValue({
showModal: false,
toggleModal: () => null,
})
})

it('renders an intervention modal with appropriate text', () => {
renderRecoveryComponent(props)
screen.getByTestId('__otInterventionModal')
screen.getByText('Recovery Mode')
screen.getByText('View error details')
})

it('renders alternative header text if the recovery mode has not been launched', () => {
props = { ...props, hasLaunchedRecovery: false }
renderRecoveryComponent(props)
screen.getByText('Cancel run')
})

it('renders the error details modal when showModal is true', () => {
vi.mocked(useErrorDetailsModal).mockReturnValue({
showModal: true,
toggleModal: () => null,
})
renderRecoveryComponent(props)
screen.getByText('MOCK_ERROR_DETAILS_MODAL')
})
})
it.todo('add test for ErrorRecoveryComponent.')
Loading