From 4bad6e16376e7e47580d475f50af9806af6ba2e7 Mon Sep 17 00:00:00 2001 From: John Bowser Date: Mon, 19 Dec 2022 10:48:21 -0700 Subject: [PATCH] add test coverage for tip length calibration active index --- .../__tests__/useGenerateTaskList.test.tsx | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/app/src/organisms/Devices/hooks/__tests__/useGenerateTaskList.test.tsx b/app/src/organisms/Devices/hooks/__tests__/useGenerateTaskList.test.tsx index d0a2e6e58b4e..37ee9a0e3761 100644 --- a/app/src/organisms/Devices/hooks/__tests__/useGenerateTaskList.test.tsx +++ b/app/src/organisms/Devices/hooks/__tests__/useGenerateTaskList.test.tsx @@ -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) @@ -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) @@ -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()