Skip to content

Commit

Permalink
add a test case for the undefined of mostRecentAnalysis
Browse files Browse the repository at this point in the history
  • Loading branch information
koji committed Nov 20, 2023
1 parent eff76b7 commit ad09667
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions app/src/pages/ProtocolDashboard/__tests__/ProtocolCard.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,23 @@ describe('ProtocolCard', () => {
)
getByText('Delete protocol')
})

it('should display the analysis failed error modal when clicking on the protocol when doing a long pressing - undefined case', async () => {
mockUseProtocolAnalysisAsDocumentQuery.mockReturnValue({
data: undefined as any,
} as UseQueryResult<CompletedProtocolAnalysis>)
const [{ getByText, getByLabelText }] = render()
const name = getByText('yay mock protocol')
fireEvent.mouseDown(name)
jest.advanceTimersByTime(1005)
expect(props.longPress).toHaveBeenCalled()
getByLabelText('failedAnalysis_icon')
getByText('Failed analysis')
getByText('yay mock protocol').click()
getByText('Protocol analysis failed')
getByText(
'Delete the protocol, make changes to address the error, and resend the protocol to this robot from the Opentrons App.'
)
getByText('Delete protocol')
})
})

0 comments on commit ad09667

Please sign in to comment.