Skip to content

Commit

Permalink
fix(app): fix CI after release merge back (#13816)
Browse files Browse the repository at this point in the history
  • Loading branch information
shlokamin authored Oct 19, 2023
1 parent e3e82e8 commit c8d3454
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 213 deletions.
13 changes: 7 additions & 6 deletions app/src/organisms/Devices/ProtocolRun/ProtocolRunSetup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -308,12 +308,14 @@ export function ProtocolRunSetup({
}
rightElement={
<StepRightElement
{...{ stepKey, runHasStarted,
{...{
stepKey,
runHasStarted,

calibrationStatusRobot,
calibrationStatusModules,
isFlex,
}}
calibrationStatusRobot,
calibrationStatusModules,
isFlex,
}}
/>
}
>
Expand All @@ -326,7 +328,6 @@ export function ProtocolRunSetup({
</Flex>
)
})

)}
</>
) : (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ import {
import { useToggleGroup } from '../../../../molecules/ToggleGroup/useToggleGroup'
import { Tooltip } from '../../../../atoms/Tooltip'
import { useFeatureFlag } from '../../../../redux/config'
import { useRunHasStarted, useUnmatchedModulesForProtocol, useModuleCalibrationStatus } from '../../hooks'
import {
useRunHasStarted,
useUnmatchedModulesForProtocol,
useModuleCalibrationStatus,
} from '../../hooks'
import { SetupModulesMap } from './SetupModulesMap'
import { SetupModulesList } from './SetupModulesList'
import { SetupFixtureList } from './SetupFixtureList'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ describe('ProtocolRunSetup', () => {
})

it('renders calibration ready if robot is Flex and modules are calibrated', () => {
when(mockUseIsOT3).calledWith(ROBOT_NAME).mockReturnValue(true)
when(mockUseIsFlex).calledWith(ROBOT_NAME).mockReturnValue(true)
when(mockUseModuleCalibrationStatus)
.calledWith(ROBOT_NAME, RUN_ID)
.mockReturnValue({ complete: true })
Expand All @@ -296,7 +296,7 @@ describe('ProtocolRunSetup', () => {
})

it('renders calibration needed if robot is Flex and modules are not calibrated', () => {
when(mockUseIsOT3).calledWith(ROBOT_NAME).mockReturnValue(true)
when(mockUseIsFlex).calledWith(ROBOT_NAME).mockReturnValue(true)
when(mockUseModuleCalibrationStatus)
.calledWith(ROBOT_NAME, RUN_ID)
.mockReturnValue({ complete: false })
Expand All @@ -308,7 +308,7 @@ describe('ProtocolRunSetup', () => {
})

it('does not render calibration element if robot is OT-2', () => {
when(mockUseIsOT3).calledWith(ROBOT_NAME).mockReturnValue(false)
when(mockUseIsFlex).calledWith(ROBOT_NAME).mockReturnValue(false)

const { getAllByText } = render()
expect(getAllByText('Calibration ready').length).toEqual(1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { renderHook } from '@testing-library/react-hooks'
import { when, resetAllWhenMocks } from 'jest-when'

import {
useIsOT3,
useIsFlex,
useModuleCalibrationStatus,
useModuleRenderInfoForProtocolById,
} from '..'
Expand All @@ -16,10 +16,10 @@ import type { ModuleModel, ModuleType } from '@opentrons/shared-data'
import { Provider } from 'react-redux'
import { createStore } from 'redux'

jest.mock('../useIsOT3')
jest.mock('../useIsFlex')
jest.mock('../useModuleRenderInfoForProtocolById')

const mockUseIsOT3 = useIsOT3 as jest.MockedFunction<typeof useIsOT3>
const mockUseIsFlex = useIsFlex as jest.MockedFunction<typeof useIsFlex>
const mockUseModuleRenderInfoForProtocolById = useModuleRenderInfoForProtocolById as jest.MockedFunction<
typeof useModuleRenderInfoForProtocolById
>
Expand Down Expand Up @@ -84,7 +84,7 @@ describe('useModuleCalibrationStatus hook', () => {
})

it('should return calibration complete if OT-2', () => {
when(mockUseIsOT3).calledWith('otie').mockReturnValue(false)
when(mockUseIsFlex).calledWith('otie').mockReturnValue(false)
when(mockUseModuleRenderInfoForProtocolById)
.calledWith('otie', '1')
.mockReturnValue({})
Expand All @@ -98,7 +98,7 @@ describe('useModuleCalibrationStatus hook', () => {
})

it('should return calibration complete if no modules needed', () => {
when(mockUseIsOT3).calledWith('otie').mockReturnValue(true)
when(mockUseIsFlex).calledWith('otie').mockReturnValue(true)
when(mockUseModuleRenderInfoForProtocolById)
.calledWith('otie', '1')
.mockReturnValue({})
Expand All @@ -112,7 +112,7 @@ describe('useModuleCalibrationStatus hook', () => {
})

it('should return calibration complete if offset date exists', () => {
when(mockUseIsOT3).calledWith('otie').mockReturnValue(true)
when(mockUseIsFlex).calledWith('otie').mockReturnValue(true)
when(mockUseModuleRenderInfoForProtocolById)
.calledWith('otie', '1')
.mockReturnValue({
Expand All @@ -134,7 +134,7 @@ describe('useModuleCalibrationStatus hook', () => {
})

it('should return calibration needed if offset date does not exist', () => {
when(mockUseIsOT3).calledWith('otie').mockReturnValue(true)
when(mockUseIsFlex).calledWith('otie').mockReturnValue(true)
when(mockUseModuleRenderInfoForProtocolById)
.calledWith('otie', '1')
.mockReturnValue({
Expand Down
4 changes: 2 additions & 2 deletions app/src/organisms/Devices/hooks/useModuleCalibrationStatus.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import omitBy from 'lodash/omitBy'
import { MAGNETIC_BLOCK_TYPE } from '@opentrons/shared-data'
import { useIsOT3 } from './useIsOT3'
import { useModuleRenderInfoForProtocolById } from './useModuleRenderInfoForProtocolById'
import { ProtocolCalibrationStatus } from './useRunCalibrationStatus'
import { useIsFlex } from './useIsFlex'

export function useModuleCalibrationStatus(
robotName: string,
runId: string
): ProtocolCalibrationStatus {
const isFlex = useIsOT3(robotName)
const isFlex = useIsFlex(robotName)
// TODO: can probably use getProtocolModulesInfo but in a rush to get out 7.0.1
const moduleRenderInfoForProtocolById = omitBy(
useModuleRenderInfoForProtocolById(robotName, runId),
Expand Down
Loading

0 comments on commit c8d3454

Please sign in to comment.