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

feat(app): implement useCalibrationTaskList hook #11894

Merged
merged 16 commits into from
Jan 5, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
rename hook to useCalibrationTaskList
  • Loading branch information
jgbowser committed Jan 5, 2023
commit decc9416fafdc50efd4db0ee4ca852202962658d
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import * as React from 'react'
import { I18nextProvider } from 'react-i18next'
import { when, resetAllWhenMocks } from 'jest-when'
import { renderHook } from '@testing-library/react-hooks'
import { useGenerateTaskList } from '../useGenerateTaskList'
import { useCalibrationTaskList } from '../useCalibrationTaskList'
import {
useAttachedPipettes,
useTipLengthCalibrations,
usePipetteOffsetCalibrations,
useDeckCalibrationData,
} from '../'
} from '..'
import {
TASK_COUNT,
mockAttachedPipettesResponse,
Expand Down Expand Up @@ -38,7 +38,7 @@ const mockUseDeckCalibrationData = useDeckCalibrationData as jest.MockedFunction
typeof useDeckCalibrationData
>

describe('useGenerateTaskList hook', () => {
describe('useCalibrationTaskList hook', () => {
let wrapper: React.FunctionComponent<{}>
beforeEach(() => {
wrapper = ({ children }) => (
Expand All @@ -65,7 +65,7 @@ describe('useGenerateTaskList hook', () => {
.calledWith('otie')
.mockReturnValue(mockCompletePipetteOffsetCalibrations)

const { result } = renderHook(() => useGenerateTaskList('otie'), {
const { result } = renderHook(() => useCalibrationTaskList('otie'), {
wrapper,
})

Expand All @@ -89,7 +89,7 @@ describe('useGenerateTaskList hook', () => {
.calledWith('otie')
.mockReturnValue(mockCompletePipetteOffsetCalibrations)

const { result } = renderHook(() => useGenerateTaskList('otie'), {
const { result } = renderHook(() => useCalibrationTaskList('otie'), {
wrapper,
})

Expand All @@ -109,7 +109,7 @@ describe('useGenerateTaskList hook', () => {
when(mockUsePipetteOffsetCalibrations)
.calledWith('otie')
.mockReturnValue(mockCompletePipetteOffsetCalibrations)
const { result } = renderHook(() => useGenerateTaskList('otie'), {
const { result } = renderHook(() => useCalibrationTaskList('otie'), {
wrapper,
})

Expand All @@ -129,7 +129,7 @@ describe('useGenerateTaskList hook', () => {
when(mockUsePipetteOffsetCalibrations)
.calledWith('otie')
.mockReturnValue(mockCompletePipetteOffsetCalibrations)
const { result } = renderHook(() => useGenerateTaskList('otie'), {
const { result } = renderHook(() => useCalibrationTaskList('otie'), {
wrapper,
})

Expand All @@ -149,7 +149,7 @@ describe('useGenerateTaskList hook', () => {
when(mockUsePipetteOffsetCalibrations)
.calledWith('otie')
.mockReturnValue(mockIncompletePipetteOffsetCalibrations) // right mount marked as bad
const { result } = renderHook(() => useGenerateTaskList('otie'), {
const { result } = renderHook(() => useCalibrationTaskList('otie'), {
wrapper,
})

Expand All @@ -169,7 +169,7 @@ describe('useGenerateTaskList hook', () => {
when(mockUsePipetteOffsetCalibrations)
.calledWith('otie')
.mockReturnValue(mockCompletePipetteOffsetCalibrations) // right mount marked as bad
const { result } = renderHook(() => useGenerateTaskList('otie'), {
const { result } = renderHook(() => useCalibrationTaskList('otie'), {
wrapper,
})

Expand All @@ -189,7 +189,7 @@ describe('useGenerateTaskList hook', () => {
when(mockUsePipetteOffsetCalibrations)
.calledWith('otie')
.mockReturnValue(mockIncompletePipetteOffsetCalibrations) // right mount marked as bad
const { result } = renderHook(() => useGenerateTaskList('otie'), {
const { result } = renderHook(() => useCalibrationTaskList('otie'), {
wrapper,
})

Expand All @@ -209,7 +209,7 @@ describe('useGenerateTaskList hook', () => {
when(mockUsePipetteOffsetCalibrations)
.calledWith('otie')
.mockReturnValue(mockIncompletePipetteOffsetCalibrations) // right mount marked as bad
const { result } = renderHook(() => useGenerateTaskList('otie'), {
const { result } = renderHook(() => useCalibrationTaskList('otie'), {
wrapper,
})

Expand Down Expand Up @@ -237,7 +237,7 @@ describe('useGenerateTaskList hook', () => {
when(mockUsePipetteOffsetCalibrations)
.calledWith('otie')
.mockReturnValue(mockCompletePipetteOffsetCalibrations)
const { result } = renderHook(() => useGenerateTaskList('otie'), {
const { result } = renderHook(() => useCalibrationTaskList('otie'), {
wrapper,
})

Expand Down
2 changes: 1 addition & 1 deletion app/src/organisms/Devices/hooks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export * from './useAttachedPipettes'
export * from './useDeckCalibrationData'
export * from './useDeckCalibrationStatus'
export * from './useDownloadRunLog'
export * from './useGenerateTaskList'
export * from './useCalibrationTaskList'
export * from './useIsOT3'
export * from './useIsRobotBusy'
export * from './useIsRobotViewable'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
useDeckCalibrationData,
usePipetteOffsetCalibrations,
useTipLengthCalibrations,
} from './'
} from '.'

import { formatTimestamp } from '../utils'

Expand All @@ -15,7 +15,7 @@ import type {
} from '../../TaskList/types'
import type { AttachedPipette } from '../../../redux/pipettes/types'

export function useGenerateTaskList(robotName: string): TaskListProps {
export function useCalibrationTaskList(robotName: string): TaskListProps {
const { t } = useTranslation(['robot_calibration', 'devices_landing'])
const TASK_LIST_LENGTH = 3
let taskIndex = 0
Expand Down