Skip to content

Commit

Permalink
add test coverage for tip length calibration active index
Browse files Browse the repository at this point in the history
  • Loading branch information
jgbowser committed Dec 19, 2022
1 parent 0b4fe4f commit 8668fda
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/src/organisms/Devices/__tests__/utils.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ describe('getIs96ChannelPipetteAttached hook', () => {

it('returns false when there is no 96 channel pipette attached on the left mount', () => {
const mockLeftMountAttachedPipette = {
name: 'mock single channel',
name: 'p1000_96',
} as FetchPipettesResponsePipette

const result = getIs96ChannelPipetteAttached(mockLeftMountAttachedPipette)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ describe('useGenerateTaskList hook', () => {
expect(result.current.taskList[2].description).toEqual('Empty')
})

it('returns the the correct active index for a task that needs to be completed without subtasks', () => {
it('returns the the correct active when Deck Calibration is needed', () => {
when(mockUseAttachedPipettes)
.calledWith()
.mockReturnValue(mockAttachedPipettesResponse)
Expand All @@ -136,7 +136,7 @@ describe('useGenerateTaskList hook', () => {
expect(result.current.activeIndex).toEqual([0, 0])
})

it('returns the the correct active index for a task with a subtask that needs to be completed', () => {
it('returns the the correct active index when a pipette is missing Offset Calibrations', () => {
when(mockUseAttachedPipettes)
.calledWith()
.mockReturnValue(mockAttachedPipettesResponse)
Expand All @@ -156,6 +156,26 @@ describe('useGenerateTaskList hook', () => {
expect(result.current.activeIndex).toEqual([2, 1])
})

it('returns the the correct active index when a pipette is missing Tip Length Calibrations', () => {
when(mockUseAttachedPipettes)
.calledWith()
.mockReturnValue(mockAttachedPipettesResponse)
when(mockUseDeckCalibrationData)
.calledWith('otie')
.mockReturnValue(mockCompleteDeckCalibration)
when(mockUseTipLengthCalibrations)
.calledWith('otie')
.mockReturnValue(mockIncompleteTipLengthCalibrations)
when(mockUsePipetteOffsetCalibrations)
.calledWith('otie')
.mockReturnValue(mockCompletePipetteOffsetCalibrations) // right mount marked as bad
const { result } = renderHook(() => useGenerateTaskList('otie'), {
wrapper,
})

expect(result.current.activeIndex).toEqual([1, 0])
})

it('returns the earliest encountered task as the active index when multiple tasks require calibrations', () => {
when(mockUseAttachedPipettes)
.calledWith()
Expand Down

0 comments on commit 8668fda

Please sign in to comment.