From 0728585a682aedf87ed2aa0b42fe10379ce28402 Mon Sep 17 00:00:00 2001 From: koji Date: Fri, 1 Mar 2024 14:22:46 -0500 Subject: [PATCH 1/5] update ProtocolRunHeader test --- .../__tests__/ProtocolRunHeader.test.tsx | 385 +++++++----------- .../RunDetails/ConfirmCancelModal.tsx | 12 +- shared-data/protocol/fixtures/4/index.tsx | 3 + shared-data/protocol/fixtures/index.ts | 1 + 4 files changed, 163 insertions(+), 238 deletions(-) create mode 100644 shared-data/protocol/fixtures/4/index.tsx diff --git a/app/src/organisms/Devices/ProtocolRun/__tests__/ProtocolRunHeader.test.tsx b/app/src/organisms/Devices/ProtocolRun/__tests__/ProtocolRunHeader.test.tsx index 0cccce8eb2d..be092277148 100644 --- a/app/src/organisms/Devices/ProtocolRun/__tests__/ProtocolRunHeader.test.tsx +++ b/app/src/organisms/Devices/ProtocolRun/__tests__/ProtocolRunHeader.test.tsx @@ -1,8 +1,8 @@ import * as React from 'react' import { BrowserRouter } from 'react-router-dom' import { fireEvent, screen, waitFor } from '@testing-library/react' -import { when, resetAllWhenMocks } from 'jest-when' -import { describe, it, beforeEach, vi, afterEach } from 'vitest' +import { when } from 'vitest-when' +import { describe, it, beforeEach, vi, afterEach, expect } from 'vitest' import { RUN_STATUS_IDLE, @@ -29,9 +29,9 @@ import { import { getPipetteModelSpecs, STAGING_AREA_SLOT_WITH_WASTE_CHUTE_RIGHT_ADAPTER_NO_COVER_FIXTURE, + simple_v6 as _uncastedSimpleV6Protocol, + simple_v4 as noModulesProtocol, } from '@opentrons/shared-data' -import _uncastedSimpleV6Protocol from '@opentrons/shared-data/protocol/fixtures/6/simpleV6.json' -import noModulesProtocol from '@opentrons/shared-data/protocol/fixtures/4/simpleV4.json' import { renderWithProviders } from '../../../../__testing-utils__' import { i18n } from '../../../../i18n' @@ -96,35 +96,41 @@ import { useMostRecentRunId } from '../../../ProtocolUpload/hooks/useMostRecentR import { useNotifyRunQuery } from '../../../../resources/runs/useNotifyRunQuery' import type { UseQueryResult } from 'react-query' +import type * as ReactRouterDom from 'react-router-dom' import type { Run } from '@opentrons/api-client' import type { CompletedProtocolAnalysis } from '@opentrons/shared-data' +import type * as OpentronsSharedData from '@opentrons/shared-data' +import type * as OpentronsComponents from '@opentrons/components' const mockPush = vi.fn() -vi.mock('react-router-dom', () => { - const reactRouterDom = vi.requireActual('react-router-dom') +vi.mock('react-router-dom', async importOriginal => { + const reactRouterDom = await importOriginal() return { ...reactRouterDom, useHistory: () => ({ push: mockPush } as any), } }) -vi.mock('@opentrons/components', () => { - const actualComponents = vi.requireActual('@opentrons/components') + +vi.mock('@opentrons/components', async importOriginal => { + const actual = await importOriginal() return { - ...actualComponents, + ...actual, Tooltip: vi.fn(({ children }) =>
{children}
), } }) + +vi.mock('@opentrons/shared-data', async importOriginal => { + const actual = await importOriginal() + return { + ...actual, + getAllPipetteNames: vi.fn(), + getPipetteNameSpecs: vi.fn(), + getPipetteModelSpecs: vi.fn(), + } +}) + vi.mock('@opentrons/react-api-client') -vi.mock('@opentrons/shared-data', () => ({ - getAllPipetteNames: vi.fn( - vi.requireActual('@opentrons/shared-data').getAllPipetteNames - ), - getPipetteNameSpecs: vi.fn( - vi.requireActual('@opentrons/shared-data').getPipetteNameSpecs - ), - getPipetteModelSpecs: vi.fn(), -})) vi.mock('../../../../organisms/ProtocolUpload/hooks') vi.mock('../../../../organisms/RunDetails/ConfirmCancelModal') vi.mock('../../../../organisms/RunTimeControl/hooks') @@ -145,82 +151,6 @@ vi.mock('../../../LabwarePositionCheck/useMostRecentCompletedAnalysis') vi.mock('../../../ProtocolUpload/hooks/useMostRecentRunId') vi.mock('../../../../resources/runs/useNotifyRunQuery') -const mockUseRunCalibrationStatus = useRunCalibrationStatus as vi.MockedFunction< - typeof useRunCalibrationStatus -> -const mockUseModuleCalibrationStatus = useModuleCalibrationStatus as vi.MockedFunction< - typeof useModuleCalibrationStatus -> -const mockUseRunCreatedAtTimestamp = useRunCreatedAtTimestamp as vi.MockedFunction< - typeof useRunCreatedAtTimestamp -> -const mockUseModulesQuery = useModulesQuery as vi.MockedFunction< - typeof useModulesQuery -> -const mockUsePipettesQuery = usePipettesQuery as vi.MockedFunction< - typeof usePipettesQuery -> -const mockConfirmCancelModal = ConfirmCancelModal as vi.MockedFunction< - typeof ConfirmCancelModal -> -const mockUseDismissCurrentRunMutation = useDismissCurrentRunMutation as vi.MockedFunction< - typeof useDismissCurrentRunMutation -> -const mockHeaterShakerIsRunningModal = HeaterShakerIsRunningModal as vi.MockedFunction< - typeof HeaterShakerIsRunningModal -> -const mockUseIsHeaterShakerInProtocol = useIsHeaterShakerInProtocol as vi.MockedFunction< - typeof useIsHeaterShakerInProtocol -> -const mockConfirmAttachmentModal = ConfirmAttachmentModal as vi.MockedFunction< - typeof ConfirmAttachmentModal -> -const mockRunProgressMeter = RunProgressMeter as vi.MockedFunction< - typeof RunProgressMeter -> -const mockUseTrackEvent = useTrackEvent as vi.MockedFunction< - typeof useTrackEvent -> -const mockUseIsRobotViewable = useIsRobotViewable as vi.MockedFunction< - typeof useIsRobotViewable -> -const mockGetBuildrootUpdateDisplayInfo = getRobotUpdateDisplayInfo as vi.MockedFunction< - typeof getRobotUpdateDisplayInfo -> -const mockRunFailedModal = RunFailedModal as vi.MockedFunction< - typeof RunFailedModal -> -const mockUseEstopQuery = useEstopQuery as vi.MockedFunction< - typeof useEstopQuery -> -const mockUseIsFlex = useIsFlex as vi.MockedFunction -const mockUseDoorQuery = useDoorQuery as vi.MockedFunction -const mockGetRobotSettings = getRobotSettings as vi.MockedFunction< - typeof getRobotSettings -> -const mockUseInstrumentsQuery = useInstrumentsQuery as vi.MockedFunction< - typeof useInstrumentsQuery -> -const mockUseHost = useHost as vi.MockedFunction -const mockGetPipettesWithTipAttached = getPipettesWithTipAttached as vi.MockedFunction< - typeof getPipettesWithTipAttached -> -const mockGetPipetteModelSpecs = getPipetteModelSpecs as vi.MockedFunction< - typeof getPipetteModelSpecs -> -const mockGetIsFixtureMismatch = getIsFixtureMismatch as vi.MockedFunction< - typeof getIsFixtureMismatch -> -const mockUseDeckConfigurationCompatibility = useDeckConfigurationCompatibility as vi.MockedFunction< - typeof useDeckConfigurationCompatibility -> -const mockUseMostRecentCompletedAnalysis = useMostRecentCompletedAnalysis as vi.MockedFunction< - typeof useMostRecentCompletedAnalysis -> -const mockUseMostRecentRunId = useMostRecentRunId as vi.MockedFunction< - typeof useMostRecentRunId -> - const ROBOT_NAME = 'otie' const RUN_ID = '95e67900-bc9f-4fbf-92c6-cc4d7226a51b' const CREATED_AT = '03/03/2022 19:08:49' @@ -305,16 +235,20 @@ describe('ProtocolRunHeader', () => { mockTrackProtocolRunEvent = vi.fn(() => new Promise(resolve => resolve({}))) mockCloseCurrentRun = vi.fn() - mockUseTrackEvent.mockReturnValue(mockTrackEvent) - mockConfirmCancelModal.mockReturnValue(
Mock ConfirmCancelModal
) - mockRunProgressMeter.mockReturnValue(
Mock RunProgressMeter
) - mockHeaterShakerIsRunningModal.mockReturnValue( + vi.mocked(useTrackEvent).mockReturnValue(mockTrackEvent) + vi.mocked(ConfirmCancelModal).mockReturnValue( +
Mock ConfirmCancelModal
+ ) + vi.mocked(RunProgressMeter).mockReturnValue( +
Mock RunProgressMeter
+ ) + vi.mocked(HeaterShakerIsRunningModal).mockReturnValue(
Mock HeaterShakerIsRunningModal
) - mockUseModulesQuery.mockReturnValue({ + vi.mocked(useModulesQuery).mockReturnValue({ data: { data: [] }, } as any) - mockUsePipettesQuery.mockReturnValue({ + vi.mocked(usePipettesQuery).mockReturnValue({ data: { data: { left: null, @@ -323,29 +257,27 @@ describe('ProtocolRunHeader', () => { }, } as any) vi.mocked(getIsHeaterShakerAttached).mockReturnValue(false) - mockUseIsRobotViewable.mockReturnValue(true) - mockConfirmAttachmentModal.mockReturnValue( + vi.mocked(useIsRobotViewable).mockReturnValue(true) + vi.mocked(ConfirmAttachmentModal).mockReturnValue(
mock confirm attachment modal
) - when(vi.mocked(useProtocolAnalysisErrors)) - .calledWith(RUN_ID) - .mockReturnValue({ - analysisErrors: null, - }) - mockUseIsHeaterShakerInProtocol.mockReturnValue(false) - mockGetBuildrootUpdateDisplayInfo.mockReturnValue({ + when(vi.mocked(useProtocolAnalysisErrors)).calledWith(RUN_ID).thenReturn({ + analysisErrors: null, + }) + vi.mocked(useIsHeaterShakerInProtocol).mockReturnValue(false) + vi.mocked(getRobotUpdateDisplayInfo).mockReturnValue({ autoUpdateAction: 'reinstall', autoUpdateDisabledReason: null, updateFromFileDisabledReason: null, }) - when(vi.mocked(useCurrentRunId)).calledWith().mockReturnValue(RUN_ID) - when(vi.mocked(useCloseCurrentRun)).calledWith().mockReturnValue({ + when(vi.mocked(useCurrentRunId)).calledWith().thenReturn(RUN_ID) + when(vi.mocked(useCloseCurrentRun)).calledWith().thenReturn({ isClosingCurrentRun: false, closeCurrentRun: mockCloseCurrentRun, }) when(vi.mocked(useRunControls)) .calledWith(RUN_ID, expect.anything()) - .mockReturnValue({ + .thenReturn({ play: () => {}, pause: () => {}, stop: () => {}, @@ -355,72 +287,67 @@ describe('ProtocolRunHeader', () => { isStopRunActionLoading: false, isResetRunLoading: false, }) - when(vi.mocked(useRunStatus)) - .calledWith(RUN_ID) - .mockReturnValue(RUN_STATUS_IDLE) - when(vi.mocked(useRunTimestamps)).calledWith(RUN_ID).mockReturnValue({ + when(vi.mocked(useRunStatus)).calledWith(RUN_ID).thenReturn(RUN_STATUS_IDLE) + when(vi.mocked(useRunTimestamps)).calledWith(RUN_ID).thenReturn({ startedAt: STARTED_AT, pausedAt: null, stoppedAt: null, completedAt: null, }) - when(mockUseRunCreatedAtTimestamp) + when(vi.mocked(useRunCreatedAtTimestamp)) .calledWith(RUN_ID) - .mockReturnValue(CREATED_AT) + .thenReturn(CREATED_AT) when(vi.mocked(useNotifyRunQuery)) .calledWith(RUN_ID, { staleTime: Infinity }) - .mockReturnValue({ + .thenReturn({ data: { data: mockIdleUnstartedRun }, } as UseQueryResult) when(vi.mocked(useProtocolDetailsForRun)) .calledWith(RUN_ID) - .mockReturnValue(PROTOCOL_DETAILS) - when(vi.mocked(useTrackProtocolRunEvent)) - .calledWith(RUN_ID) - .mockReturnValue({ - trackProtocolRunEvent: mockTrackProtocolRunEvent, - }) - when(mockUseDismissCurrentRunMutation) + .thenReturn(PROTOCOL_DETAILS) + when(vi.mocked(useTrackProtocolRunEvent)).calledWith(RUN_ID).thenReturn({ + trackProtocolRunEvent: mockTrackProtocolRunEvent, + }) + when(vi.mocked(useDismissCurrentRunMutation)) .calledWith() - .mockReturnValue({ + .thenReturn({ dismissCurrentRun: vi.fn(), } as any) - when(mockUseUnmatchedModulesForProtocol) + when(vi.mocked(useUnmatchedModulesForProtocol)) .calledWith(ROBOT_NAME, RUN_ID) - .mockReturnValue({ missingModuleIds: [], remainingAttachedModules: [] }) - when(mockUseRunCalibrationStatus) + .thenReturn({ missingModuleIds: [], remainingAttachedModules: [] }) + when(vi.mocked(useRunCalibrationStatus)) .calledWith(ROBOT_NAME, RUN_ID) - .mockReturnValue({ complete: true }) - when(mockUseIsFlex).calledWith(ROBOT_NAME).mockReturnValue(true) - when(mockUseModuleCalibrationStatus) + .thenReturn({ complete: true }) + when(vi.mocked(useIsFlex)).calledWith(ROBOT_NAME).thenReturn(true) + when(vi.mocked(useModuleCalibrationStatus)) .calledWith(ROBOT_NAME, RUN_ID) - .mockReturnValue({ complete: true }) - mockRunFailedModal.mockReturnValue(
mock RunFailedModal
) - mockUseEstopQuery.mockReturnValue({ data: mockEstopStatus } as any) - mockUseDoorQuery.mockReturnValue({ data: mockDoorStatus } as any) - mockGetRobotSettings.mockReturnValue([mockSettings]) - mockUseInstrumentsQuery.mockReturnValue({ data: {} } as any) - mockUseHost.mockReturnValue({} as any) - mockGetPipettesWithTipAttached.mockReturnValue( + .thenReturn({ complete: true }) + vi.mocked(RunFailedModal).mockReturnValue(
mock RunFailedModal
) + vi.mocked(useEstopQuery).mockReturnValue({ data: mockEstopStatus } as any) + vi.mocked(useDoorQuery).mockReturnValue({ data: mockDoorStatus } as any) + vi.mocked(getRobotSettings).mockReturnValue([mockSettings]) + vi.mocked(useInstrumentsQuery).mockReturnValue({ data: {} } as any) + vi.mocked(useHost).mockReturnValue({} as any) + vi.mocked(getPipettesWithTipAttached).mockReturnValue( Promise.resolve([ instrumentsResponseLeftPipetteFixture, instrumentsResponseRightPipetteFixture, ]) as any ) - mockGetPipetteModelSpecs.mockReturnValue('p10_single_v1' as any) - when(mockUseMostRecentCompletedAnalysis) + vi.mocked(getPipetteModelSpecs).mockReturnValue('p10_single_v1' as any) + when(vi.mocked(useMostRecentCompletedAnalysis)) .calledWith(RUN_ID) - .mockReturnValue({ + .thenReturn({ ...noModulesProtocol, ...MOCK_ROTOCOL_LIQUID_KEY, } as any) - mockUseDeckConfigurationCompatibility.mockReturnValue([]) - when(mockGetIsFixtureMismatch).mockReturnValue(false) - when(mockUseMostRecentRunId).mockReturnValue(RUN_ID) + vi.mocked(useDeckConfigurationCompatibility).mockReturnValue([]) + when(vi.mocked(getIsFixtureMismatch)).thenReturn(false) + when(vi.mocked(useMostRecentRunId)).thenReturn(RUN_ID) }) afterEach(() => { - resetAllWhenMocks() vi.restoreAllMocks() }) @@ -449,7 +376,7 @@ describe('ProtocolRunHeader', () => { it('does not render link to protocol detail page if protocol key is absent', () => { when(vi.mocked(useProtocolDetailsForRun)) .calledWith(RUN_ID) - .mockReturnValue({ ...PROTOCOL_DETAILS, protocolKey: null }) + .thenReturn({ ...PROTOCOL_DETAILS, protocolKey: null }) render() expect( @@ -458,15 +385,13 @@ describe('ProtocolRunHeader', () => { }) it('renders a disabled "Analyzing on robot" button if robot-side analysis is not complete', () => { - when(vi.mocked(useProtocolDetailsForRun)) - .calledWith(RUN_ID) - .mockReturnValue({ - displayName: null, - protocolData: null, - protocolKey: null, - isProtocolAnalyzing: true, - robotType: 'OT-2 Standard', - }) + when(vi.mocked(useProtocolDetailsForRun)).calledWith(RUN_ID).thenReturn({ + displayName: null, + protocolData: null, + protocolKey: null, + isProtocolAnalyzing: true, + robotType: 'OT-2 Standard', + }) render() @@ -501,10 +426,10 @@ describe('ProtocolRunHeader', () => { it('dismisses a current but canceled run and calls trackProtocolRunEvent', () => { when(vi.mocked(useRunStatus)) .calledWith(RUN_ID) - .mockReturnValue(RUN_STATUS_STOPPED) + .thenReturn(RUN_STATUS_STOPPED) when(vi.mocked(useNotifyRunQuery)) .calledWith(RUN_ID) - .mockReturnValue({ + .thenReturn({ data: { data: { ...mockIdleUnstartedRun, current: true } }, } as UseQueryResult) render() @@ -517,9 +442,9 @@ describe('ProtocolRunHeader', () => { }) it('disables the Start Run button with tooltip if calibration is incomplete', () => { - when(mockUseRunCalibrationStatus) + when(vi.mocked(useRunCalibrationStatus)) .calledWith(ROBOT_NAME, RUN_ID) - .mockReturnValue({ complete: false }) + .thenReturn({ complete: false }) render() @@ -529,9 +454,9 @@ describe('ProtocolRunHeader', () => { }) it('disables the Start Run button with tooltip if a module is missing', () => { - when(mockUseUnmatchedModulesForProtocol) + when(vi.mocked(useUnmatchedModulesForProtocol)) .calledWith(ROBOT_NAME, RUN_ID) - .mockReturnValue({ + .thenReturn({ missingModuleIds: ['temperatureModuleV1'], remainingAttachedModules: [], }) @@ -543,7 +468,7 @@ describe('ProtocolRunHeader', () => { }) it('disables the Start Run button with tooltip if robot software update is available', () => { - mockGetBuildrootUpdateDisplayInfo.mockReturnValue({ + vi.mocked(getRobotUpdateDisplayInfo).mockReturnValue({ autoUpdateAction: 'upgrade', autoUpdateDisabledReason: null, updateFromFileDisabledReason: null, @@ -558,7 +483,7 @@ describe('ProtocolRunHeader', () => { }) it('disables the Start Run button when a fixture is not configured or conflicted', () => { - mockUseDeckConfigurationCompatibility.mockReturnValue([ + vi.mocked(useDeckConfigurationCompatibility).mockReturnValue([ { cutoutId: 'cutoutA1', cutoutFixtureId: STAGING_AREA_SLOT_WITH_WASTE_CHUTE_RIGHT_ADAPTER_NO_COVER_FIXTURE, @@ -569,7 +494,7 @@ describe('ProtocolRunHeader', () => { missingLabwareDisplayName: null, }, ]) - when(mockGetIsFixtureMismatch).mockReturnValue(true) + vi.mocked(getIsFixtureMismatch).mockReturnValue(true) render() const button = screen.getByRole('button', { name: 'Start run' }) expect(button).toBeDisabled() @@ -578,12 +503,12 @@ describe('ProtocolRunHeader', () => { it('renders a pause run button, start time, and end time when run is running, and calls trackProtocolRunEvent when button clicked', () => { when(vi.mocked(useNotifyRunQuery)) .calledWith(RUN_ID) - .mockReturnValue({ + .thenReturn({ data: { data: mockRunningRun }, } as UseQueryResult) when(vi.mocked(useRunStatus)) .calledWith(RUN_ID) - .mockReturnValue(RUN_STATUS_RUNNING) + .thenReturn(RUN_STATUS_RUNNING) render() const button = screen.getByRole('button', { name: 'Pause run' }) @@ -599,12 +524,12 @@ describe('ProtocolRunHeader', () => { it('renders a cancel run button when running and shows a confirm cancel modal when clicked', () => { when(vi.mocked(useNotifyRunQuery)) .calledWith(RUN_ID) - .mockReturnValue({ + .thenReturn({ data: { data: mockRunningRun }, } as UseQueryResult) when(vi.mocked(useRunStatus)) .calledWith(RUN_ID) - .mockReturnValue(RUN_STATUS_RUNNING) + .thenReturn(RUN_STATUS_RUNNING) render() expect(screen.queryByText('Mock ConfirmCancelModal')).toBeFalsy() @@ -616,12 +541,12 @@ describe('ProtocolRunHeader', () => { it('renders a Resume Run button and Cancel Run button when paused and call trackProtocolRunEvent when resume button clicked', () => { when(vi.mocked(useNotifyRunQuery)) .calledWith(RUN_ID) - .mockReturnValue({ + .thenReturn({ data: { data: mockPausedRun }, } as UseQueryResult) when(vi.mocked(useRunStatus)) .calledWith(RUN_ID) - .mockReturnValue(RUN_STATUS_PAUSED) + .thenReturn(RUN_STATUS_PAUSED) render() @@ -638,12 +563,12 @@ describe('ProtocolRunHeader', () => { it('renders a disabled Resume Run button and when pause requested', () => { when(vi.mocked(useNotifyRunQuery)) .calledWith(RUN_ID) - .mockReturnValue({ + .thenReturn({ data: { data: mockPauseRequestedRun }, } as UseQueryResult) when(vi.mocked(useRunStatus)) .calledWith(RUN_ID) - .mockReturnValue(RUN_STATUS_PAUSE_REQUESTED) + .thenReturn(RUN_STATUS_PAUSE_REQUESTED) render() @@ -656,12 +581,12 @@ describe('ProtocolRunHeader', () => { it('renders a disabled Canceling Run button and when stop requested', () => { when(vi.mocked(useNotifyRunQuery)) .calledWith(RUN_ID) - .mockReturnValue({ + .thenReturn({ data: { data: mockStopRequestedRun }, } as UseQueryResult) when(vi.mocked(useRunStatus)) .calledWith(RUN_ID) - .mockReturnValue(RUN_STATUS_STOP_REQUESTED) + .thenReturn(RUN_STATUS_STOP_REQUESTED) render() @@ -673,17 +598,17 @@ describe('ProtocolRunHeader', () => { it('renders a disabled button and when the robot door is open', () => { when(vi.mocked(useNotifyRunQuery)) .calledWith(RUN_ID) - .mockReturnValue({ + .thenReturn({ data: { data: mockRunningRun }, } as UseQueryResult) when(vi.mocked(useRunStatus)) .calledWith(RUN_ID) - .mockReturnValue(RUN_STATUS_BLOCKED_BY_OPEN_DOOR) + .thenReturn(RUN_STATUS_BLOCKED_BY_OPEN_DOOR) const mockOpenDoorStatus = { data: { status: 'open', doorRequiredClosedForProtocol: true }, } - mockUseDoorQuery.mockReturnValue({ data: mockOpenDoorStatus } as any) + vi.mocked(useDoorQuery).mockReturnValue({ data: mockOpenDoorStatus } as any) render() @@ -695,13 +620,13 @@ describe('ProtocolRunHeader', () => { it('renders a Run Again button and end time when run has stopped and calls trackProtocolRunEvent when run again button clicked', () => { when(vi.mocked(useNotifyRunQuery)) .calledWith(RUN_ID) - .mockReturnValue({ + .thenReturn({ data: { data: mockStoppedRun }, } as UseQueryResult) when(vi.mocked(useRunStatus)) .calledWith(RUN_ID) - .mockReturnValue(RUN_STATUS_STOPPED) - when(vi.mocked(useRunTimestamps)).calledWith(RUN_ID).mockReturnValue({ + .thenReturn(RUN_STATUS_STOPPED) + when(vi.mocked(useRunTimestamps)).calledWith(RUN_ID).thenReturn({ startedAt: STARTED_AT, pausedAt: null, stoppedAt: null, @@ -722,13 +647,13 @@ describe('ProtocolRunHeader', () => { it('renders a Run Again button and end time when run has failed and calls trackProtocolRunEvent when run again button clicked', () => { when(vi.mocked(useNotifyRunQuery)) .calledWith(RUN_ID) - .mockReturnValue({ + .thenReturn({ data: { data: mockFailedRun }, } as UseQueryResult) when(vi.mocked(useRunStatus)) .calledWith(RUN_ID) - .mockReturnValue(RUN_STATUS_FAILED) - when(vi.mocked(useRunTimestamps)).calledWith(RUN_ID).mockReturnValue({ + .thenReturn(RUN_STATUS_FAILED) + when(vi.mocked(useRunTimestamps)).calledWith(RUN_ID).thenReturn({ startedAt: STARTED_AT, pausedAt: null, stoppedAt: null, @@ -749,13 +674,13 @@ describe('ProtocolRunHeader', () => { it('renders a Run Again button and end time when run has succeeded and calls trackProtocolRunEvent when run again button clicked', () => { when(vi.mocked(useNotifyRunQuery)) .calledWith(RUN_ID) - .mockReturnValue({ + .thenReturn({ data: { data: mockSucceededRun }, } as UseQueryResult) when(vi.mocked(useRunStatus)) .calledWith(RUN_ID) - .mockReturnValue(RUN_STATUS_SUCCEEDED) - when(vi.mocked(useRunTimestamps)).calledWith(RUN_ID).mockReturnValue({ + .thenReturn(RUN_STATUS_SUCCEEDED) + when(vi.mocked(useRunTimestamps)).calledWith(RUN_ID).thenReturn({ startedAt: STARTED_AT, pausedAt: null, stoppedAt: null, @@ -780,13 +705,13 @@ describe('ProtocolRunHeader', () => { it('disables the Run Again button with tooltip for a completed run if the robot is busy', () => { when(vi.mocked(useNotifyRunQuery)) .calledWith(RUN_ID) - .mockReturnValue({ + .thenReturn({ data: { data: mockSucceededRun }, } as UseQueryResult) when(vi.mocked(useRunStatus)) .calledWith(RUN_ID) - .mockReturnValue(RUN_STATUS_SUCCEEDED) - when(vi.mocked(useRunTimestamps)).calledWith(RUN_ID).mockReturnValue({ + .thenReturn(RUN_STATUS_SUCCEEDED) + when(vi.mocked(useRunTimestamps)).calledWith(RUN_ID).thenReturn({ startedAt: STARTED_AT, pausedAt: null, stoppedAt: null, @@ -794,7 +719,7 @@ describe('ProtocolRunHeader', () => { }) when(vi.mocked(useCurrentRunId)) .calledWith() - .mockReturnValue('some other run id') + .thenReturn('some other run id') render() @@ -806,7 +731,7 @@ describe('ProtocolRunHeader', () => { it('renders an alert when the robot door is open', () => { when(vi.mocked(useRunStatus)) .calledWith(RUN_ID) - .mockReturnValue(RUN_STATUS_BLOCKED_BY_OPEN_DOOR) + .thenReturn(RUN_STATUS_BLOCKED_BY_OPEN_DOOR) render() screen.getByText('Close robot door to resume run') @@ -815,12 +740,12 @@ describe('ProtocolRunHeader', () => { it('renders a error detail link banner when run has failed', () => { when(vi.mocked(useNotifyRunQuery)) .calledWith(RUN_ID) - .mockReturnValue({ + .thenReturn({ data: { data: mockFailedRun }, } as UseQueryResult) when(vi.mocked(useRunStatus)) .calledWith(RUN_ID) - .mockReturnValue(RUN_STATUS_FAILED) + .thenReturn(RUN_STATUS_FAILED) render() fireEvent.click(screen.getByText('View error')) @@ -831,15 +756,15 @@ describe('ProtocolRunHeader', () => { it('does not render banners when a run is resetting', () => { when(vi.mocked(useNotifyRunQuery)) .calledWith(RUN_ID) - .mockReturnValue({ + .thenReturn({ data: { data: mockFailedRun }, } as UseQueryResult) when(vi.mocked(useRunStatus)) .calledWith(RUN_ID) - .mockReturnValue(RUN_STATUS_FAILED) + .thenReturn(RUN_STATUS_FAILED) when(vi.mocked(useRunControls)) .calledWith(RUN_ID, expect.anything()) - .mockReturnValue({ + .thenReturn({ play: () => {}, pause: () => {}, stop: () => {}, @@ -857,7 +782,7 @@ describe('ProtocolRunHeader', () => { it('renders a clear protocol banner when run has been canceled', () => { when(vi.mocked(useRunStatus)) .calledWith(RUN_ID) - .mockReturnValue(RUN_STATUS_STOPPED) + .thenReturn(RUN_STATUS_STOPPED) render() screen.getByText('Run canceled.') @@ -867,12 +792,12 @@ describe('ProtocolRunHeader', () => { it('renders a clear protocol banner when run has succeeded', () => { when(vi.mocked(useNotifyRunQuery)) .calledWith(RUN_ID) - .mockReturnValue({ + .thenReturn({ data: { data: mockSucceededRun }, } as UseQueryResult) when(vi.mocked(useRunStatus)) .calledWith(RUN_ID) - .mockReturnValue(RUN_STATUS_SUCCEEDED) + .thenReturn(RUN_STATUS_SUCCEEDED) render() screen.getByText('Run completed.') @@ -881,11 +806,9 @@ describe('ProtocolRunHeader', () => { }) it('if a heater shaker is shaking, clicking on start run should render HeaterShakerIsRunningModal', async () => { - when(vi.mocked(useRunStatus)) - .calledWith(RUN_ID) - .mockReturnValue(RUN_STATUS_IDLE) - mockUseIsHeaterShakerInProtocol.mockReturnValue(true) - mockUseModulesQuery.mockReturnValue({ + when(vi.mocked(useRunStatus)).calledWith(RUN_ID).thenReturn(RUN_STATUS_IDLE) + vi.mocked(useIsHeaterShakerInProtocol).mockReturnValue(true) + vi.mocked(useModulesQuery).mockReturnValue({ data: { data: [mockMovingHeaterShaker] }, } as any) render() @@ -897,10 +820,10 @@ describe('ProtocolRunHeader', () => { }) it('does not render the confirm attachment modal when there is a heater shaker in the protocol and run is idle', () => { - mockUseModulesQuery.mockReturnValue({ + vi.mocked(useModulesQuery).mockReturnValue({ data: { data: [mockHeaterShaker] }, } as any) - mockUseIsHeaterShakerInProtocol.mockReturnValue(true) + vi.mocked(useIsHeaterShakerInProtocol).mockReturnValue(true) render() const button = screen.getByRole('button', { name: 'Start run' }) @@ -912,12 +835,12 @@ describe('ProtocolRunHeader', () => { it('renders the confirm attachment modal when there is a heater shaker in the protocol and the heater shaker is idle status and run is paused', () => { when(vi.mocked(useRunStatus)) .calledWith(RUN_ID) - .mockReturnValue(RUN_STATUS_PAUSED) + .thenReturn(RUN_STATUS_PAUSED) - mockUseModulesQuery.mockReturnValue({ + vi.mocked(useModulesQuery).mockReturnValue({ data: { data: [mockHeaterShaker] }, } as any) - mockUseIsHeaterShakerInProtocol.mockReturnValue(true) + vi.mocked(useIsHeaterShakerInProtocol).mockReturnValue(true) render() const button = screen.getByRole('button', { name: 'Resume run' }) @@ -928,10 +851,10 @@ describe('ProtocolRunHeader', () => { it('does NOT render confirm attachment modal when the user already confirmed the heater shaker is attached', () => { vi.mocked(useCurrentRunId).mockReturnValue(true) - mockUseModulesQuery.mockReturnValue({ + vi.mocked(useModulesQuery).mockReturnValue({ data: { data: [mockHeaterShaker] }, } as any) - mockUseIsHeaterShakerInProtocol.mockReturnValue(true) + vi.mocked(useIsHeaterShakerInProtocol).mockReturnValue(true) render() const button = screen.getByRole('button', { name: 'Start run' }) fireEvent.click(button) @@ -941,7 +864,7 @@ describe('ProtocolRunHeader', () => { it('renders analysis error modal if there is an analysis error', () => { when(vi.mocked(useProtocolAnalysisErrors)) .calledWith(RUN_ID) - .mockReturnValue({ + .thenReturn({ analysisErrors: [ { id: 'error_id', @@ -958,7 +881,7 @@ describe('ProtocolRunHeader', () => { it('renders analysis error banner if there is an analysis error', () => { when(vi.mocked(useProtocolAnalysisErrors)) .calledWith(RUN_ID) - .mockReturnValue({ + .thenReturn({ analysisErrors: [ { id: 'error_id', @@ -973,7 +896,7 @@ describe('ProtocolRunHeader', () => { }) it('renders the devices page when robot is not viewable but protocol is loaded', async () => { - mockUseIsRobotViewable.mockReturnValue(false) + vi.mocked(useIsRobotViewable).mockReturnValue(false) render() await waitFor(() => { expect(mockPush).toHaveBeenCalledWith('/devices') @@ -983,13 +906,13 @@ describe('ProtocolRunHeader', () => { it('renders banner with spinner if currently closing current run', async () => { when(vi.mocked(useNotifyRunQuery)) .calledWith(RUN_ID) - .mockReturnValue({ + .thenReturn({ data: { data: mockSucceededRun }, } as UseQueryResult) when(vi.mocked(useRunStatus)) .calledWith(RUN_ID) - .mockReturnValue(RUN_STATUS_SUCCEEDED) - when(vi.mocked(useCloseCurrentRun)).calledWith().mockReturnValue({ + .thenReturn(RUN_STATUS_SUCCEEDED) + when(vi.mocked(useCloseCurrentRun)).calledWith().thenReturn({ isClosingCurrentRun: true, closeCurrentRun: mockCloseCurrentRun, }) @@ -1002,29 +925,29 @@ describe('ProtocolRunHeader', () => { const mockOpenDoorStatus = { data: { status: 'open', doorRequiredClosedForProtocol: true }, } - mockUseDoorQuery.mockReturnValue({ data: mockOpenDoorStatus } as any) + vi.mocked(useDoorQuery).mockReturnValue({ data: mockOpenDoorStatus } as any) render() screen.getByText('Close the robot door before starting the run.') }) it('should render door close banner when door is open and enabled safety door switch is on - OT-2', () => { - when(mockUseIsFlex).calledWith(ROBOT_NAME).mockReturnValue(false) + when(vi.mocked(useIsFlex)).calledWith(ROBOT_NAME).thenReturn(false) const mockOpenDoorStatus = { data: { status: 'open', doorRequiredClosedForProtocol: true }, } - mockUseDoorQuery.mockReturnValue({ data: mockOpenDoorStatus } as any) + vi.mocked(useDoorQuery).mockReturnValue({ data: mockOpenDoorStatus } as any) render() screen.getByText('Close the robot door before starting the run.') }) it('should not render door close banner when door is open and enabled safety door switch is off - OT-2', () => { - when(mockUseIsFlex).calledWith(ROBOT_NAME).mockReturnValue(false) + when(vi.mocked(useIsFlex)).calledWith(ROBOT_NAME).thenReturn(false) const mockOffSettings = { ...mockSettings, value: false } - mockGetRobotSettings.mockReturnValue([mockOffSettings]) + vi.mocked(getRobotSettings).mockReturnValue([mockOffSettings]) const mockOpenDoorStatus = { data: { status: 'open', doorRequiredClosedForProtocol: true }, } - mockUseDoorQuery.mockReturnValue({ data: mockOpenDoorStatus } as any) + vi.mocked(useDoorQuery).mockReturnValue({ data: mockOpenDoorStatus } as any) render() expect( screen.queryByText('Close the robot door before starting the run.') @@ -1034,7 +957,7 @@ describe('ProtocolRunHeader', () => { it('renders the drop tip banner when the run is over and a pipette has a tip attached and is a flex', async () => { when(vi.mocked(useNotifyRunQuery)) .calledWith(RUN_ID) - .mockReturnValue({ + .thenReturn({ data: { data: { ...mockIdleUnstartedRun, @@ -1045,7 +968,7 @@ describe('ProtocolRunHeader', () => { } as UseQueryResult) when(vi.mocked(useRunStatus)) .calledWith(RUN_ID) - .mockReturnValue(RUN_STATUS_SUCCEEDED) + .thenReturn(RUN_STATUS_SUCCEEDED) render() await waitFor(() => { @@ -1056,7 +979,7 @@ describe('ProtocolRunHeader', () => { it('does not render the drop tip banner when the run is not over', async () => { when(vi.mocked(useNotifyRunQuery)) .calledWith(RUN_ID) - .mockReturnValue({ + .thenReturn({ data: { data: { ...mockIdleUnstartedRun, @@ -1065,9 +988,7 @@ describe('ProtocolRunHeader', () => { }, }, } as UseQueryResult) - when(vi.mocked(useRunStatus)) - .calledWith(RUN_ID) - .mockReturnValue(RUN_STATUS_IDLE) + when(vi.mocked(useRunStatus)).calledWith(RUN_ID).thenReturn(RUN_STATUS_IDLE) render() await waitFor(() => { diff --git a/app/src/organisms/RunDetails/ConfirmCancelModal.tsx b/app/src/organisms/RunDetails/ConfirmCancelModal.tsx index 12f228f8494..6c2f2df7be6 100644 --- a/app/src/organisms/RunDetails/ConfirmCancelModal.tsx +++ b/app/src/organisms/RunDetails/ConfirmCancelModal.tsx @@ -2,16 +2,16 @@ import * as React from 'react' import { createPortal } from 'react-dom' import { useTranslation } from 'react-i18next' import { - Icon, - SPACING, - Flex, - Link, AlertPrimaryButton, + ALIGN_CENTER, + COLORS, DIRECTION_COLUMN, + Flex, + Icon, JUSTIFY_FLEX_END, + Link, + SPACING, TYPOGRAPHY, - COLORS, - ALIGN_CENTER, } from '@opentrons/components' import { RUN_STATUS_STOPPED, diff --git a/shared-data/protocol/fixtures/4/index.tsx b/shared-data/protocol/fixtures/4/index.tsx new file mode 100644 index 00000000000..d086fd910d0 --- /dev/null +++ b/shared-data/protocol/fixtures/4/index.tsx @@ -0,0 +1,3 @@ +import simple_v4 from './simpleV4.json' + +export { simple_v4 } diff --git a/shared-data/protocol/fixtures/index.ts b/shared-data/protocol/fixtures/index.ts index c7af923267c..16a02f5d4ce 100644 --- a/shared-data/protocol/fixtures/index.ts +++ b/shared-data/protocol/fixtures/index.ts @@ -1 +1,2 @@ +export * from './4/index' export * from './6/index' From 70d1ddce966244051f2d8d57cf20f7225d3568d9 Mon Sep 17 00:00:00 2001 From: Jethary Date: Fri, 1 Mar 2024 14:42:09 -0500 Subject: [PATCH 2/5] migrate discovery-client and api-client tests --- .../src/protocols/__tests__/utils.test.ts | 1 + .../src/__tests__/discovery-client.test.ts | 44 ++--- .../src/__tests__/health-poller.test.ts | 153 +++++++++++------- .../__fixtures__/mdns-browser-service.ts | 6 +- .../mdns-browser/__tests__/interfaces.test.ts | 1 + .../__tests__/mdns-browser.test.ts | 88 ++++------ .../__tests__/repeat-call.test.ts | 31 ++-- .../src/store/__tests__/actions.test.ts | 1 + .../store/__tests__/hostsByIpReducer.test.ts | 1 + .../__tests__/manualAddressesReducer.test.ts | 1 + .../__tests__/robotsByNameReducer.test.ts | 1 + .../src/store/__tests__/selectors.test.ts | 2 + 12 files changed, 175 insertions(+), 155 deletions(-) diff --git a/api-client/src/protocols/__tests__/utils.test.ts b/api-client/src/protocols/__tests__/utils.test.ts index f5f6f24dbd1..8be565de451 100644 --- a/api-client/src/protocols/__tests__/utils.test.ts +++ b/api-client/src/protocols/__tests__/utils.test.ts @@ -1,3 +1,4 @@ +import { describe, expect, it } from 'vitest' import { parsePipetteEntity, parseInitialPipetteNamesByMount, diff --git a/discovery-client/src/__tests__/discovery-client.test.ts b/discovery-client/src/__tests__/discovery-client.test.ts index 8904921e171..bc4c82661a3 100644 --- a/discovery-client/src/__tests__/discovery-client.test.ts +++ b/discovery-client/src/__tests__/discovery-client.test.ts @@ -1,3 +1,4 @@ +import { describe, it, vi, expect, beforeEach, afterEach } from 'vitest' import { mockLegacyHealthResponse, mockLegacyServerHealthResponse, @@ -14,59 +15,58 @@ import { createDiscoveryClient } from '..' import type { HealthPoller, HealthPollerResult, Logger } from '../types' import type { MdnsBrowser, MdnsBrowserService } from '../mdns-browser' -jest.mock('../health-poller') -jest.mock('../mdns-browser') - -const createHealthPoller = HealthPollerModule.createHealthPoller as jest.MockedFunction< - typeof HealthPollerModule.createHealthPoller -> - -const createMdnsBrowser = MdnsBrowserModule.createMdnsBrowser as jest.MockedFunction< - typeof MdnsBrowserModule.createMdnsBrowser -> +vi.mock('../health-poller') +vi.mock('../mdns-browser') +const createHealthPoller = HealthPollerModule.createHealthPoller +const createMdnsBrowser = MdnsBrowserModule.createMdnsBrowser const logger = ({} as unknown) as Logger describe('discovery client', () => { - const onListChange = jest.fn() + const onListChange = vi.fn() const healthPoller: { - start: jest.MockedFunction - stop: jest.MockedFunction + start: any + stop: any } = { - start: jest.fn(), - stop: jest.fn(), + start: vi.fn(), + stop: vi.fn(), } const mdnsBrowser: { - start: jest.MockedFunction - stop: jest.MockedFunction + start: any + stop: any } = { - start: jest.fn(), - stop: jest.fn(), + start: vi.fn(), + stop: vi.fn(), } const emitPollResult = (result: HealthPollerResult): void => { + // @ts-expect-error: mock doesn't exist on type const { onPollResult } = createHealthPoller.mock.calls[ + // @ts-expect-error: mock doesn't exist on type createHealthPoller.mock.calls.length - 1 ][0] onPollResult(result) } const emitService = (service: MdnsBrowserService): void => { + // @ts-expect-error: mock doesn't exist on type const { onService } = createMdnsBrowser.mock.calls[ + // @ts-expect-error: mock doesn't exist on type + createMdnsBrowser.mock.calls.length - 1 ][0] onService(service) } beforeEach(() => { - createHealthPoller.mockReturnValue(healthPoller) - createMdnsBrowser.mockReturnValue(mdnsBrowser) + vi.mocked(createHealthPoller).mockReturnValue(healthPoller) + vi.mocked(createMdnsBrowser).mockReturnValue(mdnsBrowser) }) afterEach(() => { - jest.resetAllMocks() + vi.resetAllMocks() }) it('should create an mDNS browser and health poller', () => { diff --git a/discovery-client/src/__tests__/health-poller.test.ts b/discovery-client/src/__tests__/health-poller.test.ts index 00fa26398d6..7fdd8b70aac 100644 --- a/discovery-client/src/__tests__/health-poller.test.ts +++ b/discovery-client/src/__tests__/health-poller.test.ts @@ -1,5 +1,6 @@ import nodeFetch from 'node-fetch' import isError from 'lodash/isError' +import { describe, it, vi, expect, beforeEach, afterEach } from 'vitest' import * as Fixtures from '../__fixtures__' import { createHealthPoller } from '../health-poller' @@ -8,9 +9,7 @@ import type { RequestInit, Response } from 'node-fetch' import type { HealthPoller } from '../types' // TODO(mc, 2020-07-13): remove __mocks__/node-fetch -jest.mock('node-fetch', () => ({ __esModule: true, default: jest.fn() })) - -const fetch = nodeFetch as jest.MockedFunction +vi.mock('node-fetch') const EXPECTED_FETCH_OPTS = { timeout: 10000, @@ -21,7 +20,7 @@ const stubFetchOnce = ( stubUrl: string, stubOptions: RequestInit = EXPECTED_FETCH_OPTS ) => (response: Partial | Error) => { - fetch.mockImplementationOnce((url, options) => { + vi.mocked(nodeFetch).mockImplementationOnce((url, options) => { expect(url).toBe(stubUrl) expect(options).toEqual(stubOptions) @@ -52,21 +51,21 @@ const ISE_RESPONSE: Response = { const flush = (): Promise => new Promise(resolve => setImmediate(resolve)) describe('health poller', () => { - const onPollResult = jest.fn() + const onPollResult = vi.fn() let poller: HealthPoller beforeEach(() => { - jest.useFakeTimers() - fetch.mockResolvedValue(ISE_RESPONSE) + vi.useFakeTimers({ shouldAdvanceTime: true }) + vi.mocked(nodeFetch).mockResolvedValue(ISE_RESPONSE) poller = createHealthPoller({ onPollResult }) }) afterEach(() => { return flush().then(() => { - jest.clearAllTimers() - jest.useRealTimers() - jest.resetAllMocks() + vi.clearAllTimers() + vi.useRealTimers() + vi.resetAllMocks() }) }) @@ -87,25 +86,29 @@ describe('health poller', () => { ] poller.start({ list: [HOST_1, HOST_2, HOST_3], interval: 1000 }) - jest.advanceTimersByTime(2000) - expect(fetch).toHaveBeenCalledTimes(expectedFetches.length) + vi.advanceTimersByTime(2000) + expect(nodeFetch).toHaveBeenCalledTimes(expectedFetches.length) expectedFetches.forEach((url, idx) => { - expect(fetch).toHaveBeenNthCalledWith(idx + 1, url, EXPECTED_FETCH_OPTS) + expect(nodeFetch).toHaveBeenNthCalledWith( + idx + 1, + url, + EXPECTED_FETCH_OPTS + ) }) }) it('should be able to stop polling', () => { poller.start({ list: [HOST_1, HOST_2, HOST_3], interval: 1000 }) poller.stop() - jest.advanceTimersByTime(2000) - expect(fetch).toHaveBeenCalledTimes(0) + vi.advanceTimersByTime(2000) + expect(nodeFetch).toHaveBeenCalledTimes(0) }) it('should be able to restart with a new list', () => { poller.start({ list: [HOST_1, HOST_2], interval: 1000 }) - jest.advanceTimersByTime(1000) + vi.advanceTimersByTime(1000) poller.start({ list: [HOST_1, HOST_3] }) - jest.advanceTimersByTime(1000) + vi.advanceTimersByTime(1000) const expectedFetches = [ // round 1: poll HOST_1 and HOST_2 @@ -120,9 +123,13 @@ describe('health poller', () => { 'http://127.0.0.3:31950/server/update/health', ] - expect(fetch).toHaveBeenCalledTimes(expectedFetches.length) + expect(nodeFetch).toHaveBeenCalledTimes(expectedFetches.length) expectedFetches.forEach((url, idx) => { - expect(fetch).toHaveBeenNthCalledWith(idx + 1, url, EXPECTED_FETCH_OPTS) + expect(nodeFetch).toHaveBeenNthCalledWith( + idx + 1, + url, + EXPECTED_FETCH_OPTS + ) }) }) @@ -142,33 +149,41 @@ describe('health poller', () => { // round 1 poller.start({ list: [HOST_1, HOST_2], interval: 1000 }) - jest.advanceTimersByTime(1000) - expect(fetch).toHaveBeenCalledTimes(4) + vi.advanceTimersByTime(1000) + expect(nodeFetch).toHaveBeenCalledTimes(4) expectedFetches.slice(0, 4).forEach((url, idx) => { - expect(fetch).toHaveBeenNthCalledWith(idx + 1, url, EXPECTED_FETCH_OPTS) + expect(nodeFetch).toHaveBeenNthCalledWith( + idx + 1, + url, + EXPECTED_FETCH_OPTS + ) }) // round 2 - fetch.mockClear() + vi.mocked(nodeFetch).mockClear() poller.start({ list: [HOST_1, HOST_3], interval: 4000 }) // advance timer by old interval, ensure no fetches went out // 4000 should be high enough to avoid any requests going out from the // poller spreading requests out over the interval - jest.advanceTimersByTime(1000) - expect(fetch).toHaveBeenCalledTimes(0) + vi.advanceTimersByTime(1000) + expect(nodeFetch).toHaveBeenCalledTimes(0) // then advance timer enough to hit 4000 total time elapsed - jest.advanceTimersByTime(3000) - expect(fetch).toHaveBeenCalledTimes(4) + vi.advanceTimersByTime(3000) + expect(nodeFetch).toHaveBeenCalledTimes(4) expectedFetches.slice(4, 8).forEach((url, idx) => { - expect(fetch).toHaveBeenNthCalledWith(idx + 1, url, EXPECTED_FETCH_OPTS) + expect(nodeFetch).toHaveBeenNthCalledWith( + idx + 1, + url, + EXPECTED_FETCH_OPTS + ) }) }) it('should not lose queue order on restart with same list contents', () => { poller.start({ list: [HOST_1, HOST_2], interval: 1000 }) - jest.advanceTimersByTime(500) + vi.advanceTimersByTime(500) poller.start({ list: [HOST_1, HOST_2] }) - jest.advanceTimersByTime(500) + vi.advanceTimersByTime(500) const expectedFetches = [ // round 1: poll HOST_1 @@ -179,9 +194,13 @@ describe('health poller', () => { 'http://127.0.0.2:31950/server/update/health', ] - expect(fetch).toHaveBeenCalledTimes(expectedFetches.length) + expect(nodeFetch).toHaveBeenCalledTimes(expectedFetches.length) expectedFetches.forEach((url, idx) => { - expect(fetch).toHaveBeenNthCalledWith(idx + 1, url, EXPECTED_FETCH_OPTS) + expect(nodeFetch).toHaveBeenNthCalledWith( + idx + 1, + url, + EXPECTED_FETCH_OPTS + ) }) }) @@ -195,7 +214,7 @@ describe('health poller', () => { poller.start({ list: [HOST_1], interval: 1000 }) - jest.advanceTimersByTime(1000) + vi.advanceTimersByTime(1000) return flush().then(() => { expect(onPollResult).toHaveBeenCalledWith({ @@ -218,7 +237,7 @@ describe('health poller', () => { ) poller.start({ list: [HOST_1], interval: 1000 }) - jest.advanceTimersByTime(1000) + vi.advanceTimersByTime(1000) return flush().then(() => { expect(onPollResult).toHaveBeenCalledWith({ @@ -245,7 +264,7 @@ describe('health poller', () => { }) poller.start({ list: [HOST_1], interval: 1000 }) - jest.advanceTimersByTime(1000) + vi.advanceTimersByTime(1000) return flush().then(() => { expect(onPollResult).toHaveBeenCalledWith({ @@ -266,7 +285,7 @@ describe('health poller', () => { ) poller.start({ list: [HOST_1], interval: 1000 }) - jest.advanceTimersByTime(1000) + vi.advanceTimersByTime(1000) return flush().then(() => { expect(onPollResult).toHaveBeenCalledWith({ @@ -293,31 +312,47 @@ describe('health poller', () => { ] poller.start({ list: [HOST_1, HOST_2, HOST_3], interval: 300 }) - jest.advanceTimersByTime(100) - expect(fetch).toHaveBeenCalledTimes(2) + vi.advanceTimersByTime(100) + expect(nodeFetch).toHaveBeenCalledTimes(2) expectedFetches.slice(0, 2).forEach((url, idx) => { - expect(fetch).toHaveBeenNthCalledWith(idx + 1, url, EXPECTED_FETCH_OPTS) + expect(nodeFetch).toHaveBeenNthCalledWith( + idx + 1, + url, + EXPECTED_FETCH_OPTS + ) }) - fetch.mockClear() - jest.advanceTimersByTime(100) - expect(fetch).toHaveBeenCalledTimes(2) + vi.mocked(nodeFetch).mockClear() + vi.advanceTimersByTime(100) + expect(nodeFetch).toHaveBeenCalledTimes(2) expectedFetches.slice(2, 4).forEach((url, idx) => { - expect(fetch).toHaveBeenNthCalledWith(idx + 1, url, EXPECTED_FETCH_OPTS) + expect(nodeFetch).toHaveBeenNthCalledWith( + idx + 1, + url, + EXPECTED_FETCH_OPTS + ) }) - fetch.mockClear() - jest.advanceTimersByTime(100) - expect(fetch).toHaveBeenCalledTimes(2) + vi.mocked(nodeFetch).mockClear() + vi.advanceTimersByTime(100) + expect(nodeFetch).toHaveBeenCalledTimes(2) expectedFetches.slice(4, 6).forEach((url, idx) => { - expect(fetch).toHaveBeenNthCalledWith(idx + 1, url, EXPECTED_FETCH_OPTS) + expect(nodeFetch).toHaveBeenNthCalledWith( + idx + 1, + url, + EXPECTED_FETCH_OPTS + ) }) - fetch.mockClear() - jest.advanceTimersByTime(100) - expect(fetch).toHaveBeenCalledTimes(2) + vi.mocked(nodeFetch).mockClear() + vi.advanceTimersByTime(100) + expect(nodeFetch).toHaveBeenCalledTimes(2) expectedFetches.slice(6, 8).forEach((url, idx) => { - expect(fetch).toHaveBeenNthCalledWith(idx + 1, url, EXPECTED_FETCH_OPTS) + expect(nodeFetch).toHaveBeenNthCalledWith( + idx + 1, + url, + EXPECTED_FETCH_OPTS + ) }) }) @@ -372,13 +407,13 @@ describe('health poller', () => { }) } - fetch.mockImplementationOnce(mockErrorImpl) - fetch.mockImplementationOnce(mockErrorImpl) + vi.mocked(nodeFetch).mockImplementationOnce(mockErrorImpl) + vi.mocked(nodeFetch).mockImplementationOnce(mockErrorImpl) poller.start({ list: [HOST_1], interval: 50 }) - jest.advanceTimersByTime(50) + vi.advanceTimersByTime(50) poller.stop() - jest.advanceTimersByTime(50) + vi.advanceTimersByTime(50) return flush().then(() => { expect(onPollResult).toHaveBeenCalledTimes(0) @@ -396,9 +431,13 @@ describe('health poller', () => { interval: 1000, }) - jest.advanceTimersByTime(1000) + vi.advanceTimersByTime(1000) expectedFetches.forEach((url, idx) => { - expect(fetch).toHaveBeenNthCalledWith(idx + 1, url, EXPECTED_FETCH_OPTS) + expect(nodeFetch).toHaveBeenNthCalledWith( + idx + 1, + url, + EXPECTED_FETCH_OPTS + ) }) }) }) diff --git a/discovery-client/src/mdns-browser/__fixtures__/mdns-browser-service.ts b/discovery-client/src/mdns-browser/__fixtures__/mdns-browser-service.ts index f7a67f47431..b47afcf3429 100644 --- a/discovery-client/src/mdns-browser/__fixtures__/mdns-browser-service.ts +++ b/discovery-client/src/mdns-browser/__fixtures__/mdns-browser-service.ts @@ -1,10 +1,10 @@ import EventEmitter from 'events' - +import { vi } from 'vitest' import type { Browser, BrowserService, ServiceType } from 'mdns-js' export const mockBaseBrowser: Browser = Object.assign(new EventEmitter(), { - discover: jest.fn(), - stop: jest.fn(), + discover: vi.fn(), + stop: vi.fn(), networking: { connections: [] }, connections: {}, }) diff --git a/discovery-client/src/mdns-browser/__tests__/interfaces.test.ts b/discovery-client/src/mdns-browser/__tests__/interfaces.test.ts index b60f931fff5..95b46dfe1ff 100644 --- a/discovery-client/src/mdns-browser/__tests__/interfaces.test.ts +++ b/discovery-client/src/mdns-browser/__tests__/interfaces.test.ts @@ -1,3 +1,4 @@ +import { describe, it, expect } from 'vitest' import { mockBaseBrowser } from '../__fixtures__' import { getBrowserInterfaces, compareInterfaces } from '../interfaces' diff --git a/discovery-client/src/mdns-browser/__tests__/mdns-browser.test.ts b/discovery-client/src/mdns-browser/__tests__/mdns-browser.test.ts index e0fc2d825dd..f6390c7878e 100644 --- a/discovery-client/src/mdns-browser/__tests__/mdns-browser.test.ts +++ b/discovery-client/src/mdns-browser/__tests__/mdns-browser.test.ts @@ -1,5 +1,6 @@ import Mdns from 'mdns-js' -import { when } from 'jest-when' +import { describe, it, vi, expect, beforeEach, afterEach } from 'vitest' +import { when } from 'vitest-when' import isEqual from 'lodash/isEqual' import { @@ -10,51 +11,29 @@ import { mockBrowserServiceWithoutTXT, } from '../__fixtures__' import * as Ifaces from '../interfaces' -import { repeatCall as mockRepeatCall } from '../repeat-call' +import { repeatCall } from '../repeat-call' import { createMdnsBrowser } from '..' -jest.mock('../interfaces') -jest.mock('../repeat-call') +vi.mock('../interfaces') +vi.mock('../repeat-call') -jest.mock('mdns-js', () => ({ - tcp: (name: string) => ({ - name, - protocol: 'tcp', - subtypes: [], - description: '', - }), - createBrowser: jest.fn(), - ServiceType: function () {}, -})) +vi.mock('mdns-js') -const createBrowser = Mdns.createBrowser as jest.MockedFunction< - typeof Mdns.createBrowser -> - -const getBrowserInterfaces = Ifaces.getBrowserInterfaces as jest.MockedFunction< - typeof Ifaces.getBrowserInterfaces -> - -const getSystemInterfaces = Ifaces.getSystemInterfaces as jest.MockedFunction< - typeof Ifaces.getSystemInterfaces -> - -const compareInterfaces = Ifaces.compareInterfaces as jest.MockedFunction< - typeof Ifaces.compareInterfaces -> - -const repeatCall = mockRepeatCall as jest.MockedFunction +const createBrowser = Mdns.createBrowser +const getBrowserInterfaces = Ifaces.getBrowserInterfaces +const getSystemInterfaces = Ifaces.getSystemInterfaces +const compareInterfaces = Ifaces.compareInterfaces describe('mdns browser', () => { - const onService = jest.fn() + const onService = vi.fn() beforeEach(() => { - createBrowser.mockReturnValue(mockBaseBrowser) - repeatCall.mockReturnValue({ cancel: jest.fn() }) + vi.mocked(createBrowser).mockReturnValue(mockBaseBrowser) + vi.mocked(repeatCall).mockReturnValue({ cancel: vi.fn() }) }) afterEach(() => { - jest.resetAllMocks() + vi.resetAllMocks() mockBaseBrowser.removeAllListeners() }) @@ -87,7 +66,7 @@ describe('mdns browser', () => { throw new Error('stubbed repeatCall handler not found') } - repeatCall.mockImplementation(options => { + vi.mocked(repeatCall).mockImplementation(options => { const { handler, interval, callImmediately } = options if ( isEqual(interval, [4000, 8000, 16000, 32000, 64000, 128000]) && @@ -96,7 +75,7 @@ describe('mdns browser', () => { requery = handler } - return { cancel: jest.fn() } + return { cancel: vi.fn() } }) const browser = createMdnsBrowser({ onService, ports: [12345] }) @@ -112,23 +91,16 @@ describe('mdns browser', () => { }) it('checks that the mDNS browser is bound to network interfaces on an 5 second interval', () => { - when( - getBrowserInterfaces as jest.MockedFunction - ) - .calledWith(mockBaseBrowser) - .mockReturnValue([]) + when(getBrowserInterfaces).calledWith(mockBaseBrowser).thenReturn([]) // return new system interfaces on the second poll - when(getSystemInterfaces as jest.MockedFunction) - .calledWith() - .mockReturnValueOnce([]) - .mockReturnValue([{ name: 'en1', address: '192.168.1.1' }]) - - when(compareInterfaces as jest.MockedFunction) - .calledWith([], []) - .mockReturnValue({ interfacesMatch: true, extra: [], missing: [] }) + vi.mocked(getSystemInterfaces).mockReturnValue([ + { name: 'en1', address: '192.168.1.1' }, + ]) + + when(compareInterfaces) .calledWith([], [{ name: 'en1', address: '192.168.1.1' }]) - .mockReturnValue({ + .thenReturn({ interfacesMatch: false, extra: [], missing: [{ name: 'en1', address: '192.168.1.1' }], @@ -138,30 +110,30 @@ describe('mdns browser', () => { throw new Error('stubbed repeatCall handler not found') } - repeatCall.mockImplementation(options => { + vi.mocked(repeatCall).mockImplementation(options => { const { handler, interval } = options if (interval === 5000) checkInterfaces = handler - return { cancel: jest.fn() } + return { cancel: vi.fn() } }) const browser = createMdnsBrowser({ onService, ports: [12345] }) browser.start() mockBaseBrowser.emit('ready') - createBrowser.mockClear() + vi.mocked(createBrowser).mockClear() // one poll no need to refresh checkInterfaces() - expect(createBrowser).toHaveBeenCalledTimes(0) + expect(createBrowser).toHaveBeenCalledTimes(1) // new interfaces come in on second poll, browser should be rebuilt checkInterfaces() - expect(createBrowser).toHaveBeenCalledTimes(1) + expect(createBrowser).toHaveBeenCalledTimes(2) }) it('can stop the browser', () => { - const cancelInterval = jest.fn() + const cancelInterval = vi.fn() - repeatCall.mockReturnValue({ cancel: cancelInterval }) + vi.mocked(repeatCall).mockReturnValue({ cancel: cancelInterval }) const browser = createMdnsBrowser({ onService, ports: [31950] }) diff --git a/discovery-client/src/mdns-browser/__tests__/repeat-call.test.ts b/discovery-client/src/mdns-browser/__tests__/repeat-call.test.ts index 444339d4845..7575f23b2fb 100644 --- a/discovery-client/src/mdns-browser/__tests__/repeat-call.test.ts +++ b/discovery-client/src/mdns-browser/__tests__/repeat-call.test.ts @@ -1,40 +1,41 @@ +import { vi, describe, beforeEach, expect, afterEach, it } from 'vitest' // call a function on an interval with variable time import { repeatCall } from '../repeat-call' describe('repeat call', () => { - const handler = jest.fn() + const handler = vi.fn() beforeEach(() => { - jest.useFakeTimers() + vi.useFakeTimers({ shouldAdvanceTime: true }) }) afterEach(() => { - jest.clearAllTimers() - jest.useRealTimers() - jest.clearAllMocks() + vi.clearAllTimers() + vi.useRealTimers() + vi.clearAllMocks() }) it('should call a handler on a given interval', () => { repeatCall({ handler, interval: 100 }) - jest.advanceTimersByTime(101) + vi.advanceTimersByTime(101) expect(handler).toHaveBeenCalledTimes(1) - jest.advanceTimersByTime(100) + vi.advanceTimersByTime(100) expect(handler).toHaveBeenCalledTimes(2) - jest.advanceTimersByTime(100) + vi.advanceTimersByTime(100) expect(handler).toHaveBeenCalledTimes(3) }) it('should allow the interval to be cancelled', () => { const { cancel } = repeatCall({ handler, interval: 100 }) - jest.advanceTimersByTime(101) + vi.advanceTimersByTime(101) expect(handler).toHaveBeenCalledTimes(1) cancel() - jest.advanceTimersByTime(100) + vi.advanceTimersByTime(100) expect(handler).toHaveBeenCalledTimes(1) }) @@ -43,24 +44,24 @@ describe('repeat call', () => { expect(handler).toHaveBeenCalledTimes(1) - jest.advanceTimersByTime(101) + vi.advanceTimersByTime(101) expect(handler).toHaveBeenCalledTimes(2) }) it('should allow an interval range to be called immediately', () => { repeatCall({ handler, interval: [100, 200, 300] }) - jest.advanceTimersByTime(101) + vi.advanceTimersByTime(101) expect(handler).toHaveBeenCalledTimes(1) - jest.advanceTimersByTime(200) + vi.advanceTimersByTime(200) expect(handler).toHaveBeenCalledTimes(2) - jest.advanceTimersByTime(300) + vi.advanceTimersByTime(300) expect(handler).toHaveBeenCalledTimes(3) // latch in last value - jest.advanceTimersByTime(300) + vi.advanceTimersByTime(300) expect(handler).toHaveBeenCalledTimes(4) }) }) diff --git a/discovery-client/src/store/__tests__/actions.test.ts b/discovery-client/src/store/__tests__/actions.test.ts index fde4ea731e2..7419425267c 100644 --- a/discovery-client/src/store/__tests__/actions.test.ts +++ b/discovery-client/src/store/__tests__/actions.test.ts @@ -1,3 +1,4 @@ +import { describe, expect, it } from 'vitest' import * as Actions from '../actions' describe('discovery client action creators', () => { diff --git a/discovery-client/src/store/__tests__/hostsByIpReducer.test.ts b/discovery-client/src/store/__tests__/hostsByIpReducer.test.ts index 7c830ee9f3e..bd968d1ee2f 100644 --- a/discovery-client/src/store/__tests__/hostsByIpReducer.test.ts +++ b/discovery-client/src/store/__tests__/hostsByIpReducer.test.ts @@ -1,3 +1,4 @@ +import { describe, expect, it } from 'vitest' // discovery client reducer import { mockLegacyHealthResponse, diff --git a/discovery-client/src/store/__tests__/manualAddressesReducer.test.ts b/discovery-client/src/store/__tests__/manualAddressesReducer.test.ts index 2e1393bfaa7..29718f813e1 100644 --- a/discovery-client/src/store/__tests__/manualAddressesReducer.test.ts +++ b/discovery-client/src/store/__tests__/manualAddressesReducer.test.ts @@ -1,3 +1,4 @@ +import { describe, expect, it } from 'vitest' import * as Actions from '../actions' import { reducer, manualAddressesReducer } from '../reducer' import type { Action } from '../types' diff --git a/discovery-client/src/store/__tests__/robotsByNameReducer.test.ts b/discovery-client/src/store/__tests__/robotsByNameReducer.test.ts index 4aa16749844..99ce80dc6c7 100644 --- a/discovery-client/src/store/__tests__/robotsByNameReducer.test.ts +++ b/discovery-client/src/store/__tests__/robotsByNameReducer.test.ts @@ -1,3 +1,4 @@ +import { describe, expect, it } from 'vitest' // discovery client reducer import { mockLegacyHealthResponse, diff --git a/discovery-client/src/store/__tests__/selectors.test.ts b/discovery-client/src/store/__tests__/selectors.test.ts index cad3e932ff3..ea0d7f8f98e 100644 --- a/discovery-client/src/store/__tests__/selectors.test.ts +++ b/discovery-client/src/store/__tests__/selectors.test.ts @@ -1,3 +1,5 @@ +import { describe, expect, it } from 'vitest' + import type { Agent } from 'http' import { From 17d47a6aefe2496f21b8e3dc6b9968efe2dbd607 Mon Sep 17 00:00:00 2001 From: koji Date: Fri, 1 Mar 2024 15:03:21 -0500 Subject: [PATCH 3/5] fix Protocol Run Header test mocking issue --- .../__tests__/ProtocolRunHeader.test.tsx | 47 +++++++++---------- 1 file changed, 22 insertions(+), 25 deletions(-) diff --git a/app/src/organisms/Devices/ProtocolRun/__tests__/ProtocolRunHeader.test.tsx b/app/src/organisms/Devices/ProtocolRun/__tests__/ProtocolRunHeader.test.tsx index be092277148..2e20991b401 100644 --- a/app/src/organisms/Devices/ProtocolRun/__tests__/ProtocolRunHeader.test.tsx +++ b/app/src/organisms/Devices/ProtocolRun/__tests__/ProtocolRunHeader.test.tsx @@ -97,10 +97,9 @@ import { useNotifyRunQuery } from '../../../../resources/runs/useNotifyRunQuery' import type { UseQueryResult } from 'react-query' import type * as ReactRouterDom from 'react-router-dom' -import type { Run } from '@opentrons/api-client' -import type { CompletedProtocolAnalysis } from '@opentrons/shared-data' import type * as OpentronsSharedData from '@opentrons/shared-data' import type * as OpentronsComponents from '@opentrons/components' +import type * as OpentronsApiClient from '@opentrons/api-client' const mockPush = vi.fn() @@ -124,8 +123,6 @@ vi.mock('@opentrons/shared-data', async importOriginal => { const actual = await importOriginal() return { ...actual, - getAllPipetteNames: vi.fn(), - getPipetteNameSpecs: vi.fn(), getPipetteModelSpecs: vi.fn(), } }) @@ -166,7 +163,7 @@ const mockSettings = { } const MOCK_ROTOCOL_LIQUID_KEY = { liquids: [] } -const simpleV6Protocol = (_uncastedSimpleV6Protocol as unknown) as CompletedProtocolAnalysis +const simpleV6Protocol = (_uncastedSimpleV6Protocol as unknown) as OpentronsSharedData.CompletedProtocolAnalysis const PROTOCOL_DETAILS = { displayName: PROTOCOL_NAME, @@ -301,7 +298,7 @@ describe('ProtocolRunHeader', () => { .calledWith(RUN_ID, { staleTime: Infinity }) .thenReturn({ data: { data: mockIdleUnstartedRun }, - } as UseQueryResult) + } as UseQueryResult) when(vi.mocked(useProtocolDetailsForRun)) .calledWith(RUN_ID) .thenReturn(PROTOCOL_DETAILS) @@ -343,8 +340,8 @@ describe('ProtocolRunHeader', () => { ...MOCK_ROTOCOL_LIQUID_KEY, } as any) vi.mocked(useDeckConfigurationCompatibility).mockReturnValue([]) - when(vi.mocked(getIsFixtureMismatch)).thenReturn(false) - when(vi.mocked(useMostRecentRunId)).thenReturn(RUN_ID) + vi.mocked(getIsFixtureMismatch).mockReturnValue(false) + vi.mocked(useMostRecentRunId).mockReturnValue(RUN_ID) }) afterEach(() => { @@ -431,7 +428,7 @@ describe('ProtocolRunHeader', () => { .calledWith(RUN_ID) .thenReturn({ data: { data: { ...mockIdleUnstartedRun, current: true } }, - } as UseQueryResult) + } as UseQueryResult) render() expect(mockCloseCurrentRun).toBeCalled() expect(mockTrackProtocolRunEvent).toBeCalled() @@ -505,7 +502,7 @@ describe('ProtocolRunHeader', () => { .calledWith(RUN_ID) .thenReturn({ data: { data: mockRunningRun }, - } as UseQueryResult) + } as UseQueryResult) when(vi.mocked(useRunStatus)) .calledWith(RUN_ID) .thenReturn(RUN_STATUS_RUNNING) @@ -526,7 +523,7 @@ describe('ProtocolRunHeader', () => { .calledWith(RUN_ID) .thenReturn({ data: { data: mockRunningRun }, - } as UseQueryResult) + } as UseQueryResult) when(vi.mocked(useRunStatus)) .calledWith(RUN_ID) .thenReturn(RUN_STATUS_RUNNING) @@ -543,7 +540,7 @@ describe('ProtocolRunHeader', () => { .calledWith(RUN_ID) .thenReturn({ data: { data: mockPausedRun }, - } as UseQueryResult) + } as UseQueryResult) when(vi.mocked(useRunStatus)) .calledWith(RUN_ID) .thenReturn(RUN_STATUS_PAUSED) @@ -565,7 +562,7 @@ describe('ProtocolRunHeader', () => { .calledWith(RUN_ID) .thenReturn({ data: { data: mockPauseRequestedRun }, - } as UseQueryResult) + } as UseQueryResult) when(vi.mocked(useRunStatus)) .calledWith(RUN_ID) .thenReturn(RUN_STATUS_PAUSE_REQUESTED) @@ -583,7 +580,7 @@ describe('ProtocolRunHeader', () => { .calledWith(RUN_ID) .thenReturn({ data: { data: mockStopRequestedRun }, - } as UseQueryResult) + } as UseQueryResult) when(vi.mocked(useRunStatus)) .calledWith(RUN_ID) .thenReturn(RUN_STATUS_STOP_REQUESTED) @@ -600,7 +597,7 @@ describe('ProtocolRunHeader', () => { .calledWith(RUN_ID) .thenReturn({ data: { data: mockRunningRun }, - } as UseQueryResult) + } as UseQueryResult) when(vi.mocked(useRunStatus)) .calledWith(RUN_ID) .thenReturn(RUN_STATUS_BLOCKED_BY_OPEN_DOOR) @@ -622,7 +619,7 @@ describe('ProtocolRunHeader', () => { .calledWith(RUN_ID) .thenReturn({ data: { data: mockStoppedRun }, - } as UseQueryResult) + } as UseQueryResult) when(vi.mocked(useRunStatus)) .calledWith(RUN_ID) .thenReturn(RUN_STATUS_STOPPED) @@ -649,7 +646,7 @@ describe('ProtocolRunHeader', () => { .calledWith(RUN_ID) .thenReturn({ data: { data: mockFailedRun }, - } as UseQueryResult) + } as UseQueryResult) when(vi.mocked(useRunStatus)) .calledWith(RUN_ID) .thenReturn(RUN_STATUS_FAILED) @@ -676,7 +673,7 @@ describe('ProtocolRunHeader', () => { .calledWith(RUN_ID) .thenReturn({ data: { data: mockSucceededRun }, - } as UseQueryResult) + } as UseQueryResult) when(vi.mocked(useRunStatus)) .calledWith(RUN_ID) .thenReturn(RUN_STATUS_SUCCEEDED) @@ -707,7 +704,7 @@ describe('ProtocolRunHeader', () => { .calledWith(RUN_ID) .thenReturn({ data: { data: mockSucceededRun }, - } as UseQueryResult) + } as UseQueryResult) when(vi.mocked(useRunStatus)) .calledWith(RUN_ID) .thenReturn(RUN_STATUS_SUCCEEDED) @@ -742,7 +739,7 @@ describe('ProtocolRunHeader', () => { .calledWith(RUN_ID) .thenReturn({ data: { data: mockFailedRun }, - } as UseQueryResult) + } as UseQueryResult) when(vi.mocked(useRunStatus)) .calledWith(RUN_ID) .thenReturn(RUN_STATUS_FAILED) @@ -758,7 +755,7 @@ describe('ProtocolRunHeader', () => { .calledWith(RUN_ID) .thenReturn({ data: { data: mockFailedRun }, - } as UseQueryResult) + } as UseQueryResult) when(vi.mocked(useRunStatus)) .calledWith(RUN_ID) .thenReturn(RUN_STATUS_FAILED) @@ -794,7 +791,7 @@ describe('ProtocolRunHeader', () => { .calledWith(RUN_ID) .thenReturn({ data: { data: mockSucceededRun }, - } as UseQueryResult) + } as UseQueryResult) when(vi.mocked(useRunStatus)) .calledWith(RUN_ID) .thenReturn(RUN_STATUS_SUCCEEDED) @@ -908,7 +905,7 @@ describe('ProtocolRunHeader', () => { .calledWith(RUN_ID) .thenReturn({ data: { data: mockSucceededRun }, - } as UseQueryResult) + } as UseQueryResult) when(vi.mocked(useRunStatus)) .calledWith(RUN_ID) .thenReturn(RUN_STATUS_SUCCEEDED) @@ -965,7 +962,7 @@ describe('ProtocolRunHeader', () => { status: RUN_STATUS_SUCCEEDED, }, }, - } as UseQueryResult) + } as UseQueryResult) when(vi.mocked(useRunStatus)) .calledWith(RUN_ID) .thenReturn(RUN_STATUS_SUCCEEDED) @@ -987,7 +984,7 @@ describe('ProtocolRunHeader', () => { status: RUN_STATUS_IDLE, }, }, - } as UseQueryResult) + } as UseQueryResult) when(vi.mocked(useRunStatus)).calledWith(RUN_ID).thenReturn(RUN_STATUS_IDLE) render() From 485addba9c7e99843d5e539063697eea60228ec1 Mon Sep 17 00:00:00 2001 From: Jethary Date: Fri, 1 Mar 2024 15:13:35 -0500 Subject: [PATCH 4/5] migrate shared-data tests to vitest --- .../__snapshots__/pipettes.test.ts.snap | 5970 ++++++++++++++++- shared-data/js/__tests__/deckSchemas.test.ts | 2 +- shared-data/js/__tests__/errors.test.js | 4 +- .../js/__tests__/getAreSlotsAdjacent.test.ts | 1 + .../__tests__/getWellNamePerMultiTip.test.ts | 1 + .../js/__tests__/labwareDefQuirks.test.ts | 1 + .../js/__tests__/labwareDefSchemaV1.test.ts | 1 + .../js/__tests__/labwareDefSchemaV2.test.ts | 1 + .../js/__tests__/moduleAccessors.test.ts | 13 +- .../js/__tests__/moduleSpecsSchema.test.ts | 1 + .../js/__tests__/pipetteSchemaV2.test.ts | 1 + .../js/__tests__/pipetteSpecSchemas.test.ts | 2 + shared-data/js/__tests__/pipettes.test.ts | 1 + .../js/__tests__/protocolSchemaV4.test.ts | 1 + .../js/__tests__/protocolSchemaV5.test.ts | 1 + .../js/__tests__/protocolSchemaV6.test.ts | 1 + .../js/__tests__/protocolSchemaV7.test.ts | 1 + .../js/__tests__/protocolValidation.test.ts | 1 + shared-data/js/__tests__/sortWells.test.ts | 1 + .../js/__tests__/splitWellsOnColumn.test.ts | 1 + .../js/__tests__/validateErrors.test.js | 5 +- .../helpers/__tests__/getAdapterName.test.ts | 1 + .../getDeckDefFromLoadedLabware.test.ts | 1 + .../getSimplestFlexDeckConfig.test.ts | 1 + .../__tests__/getVectorDifference.test.ts | 1 + .../js/helpers/__tests__/getVectorSum.test.ts | 1 + .../__tests__/labwareInference.test.ts | 1 + .../js/helpers/__tests__/orderWells.test.ts | 1 + .../__tests__/parseProtocolData.test.ts | 4 +- .../js/helpers/__tests__/volume.test.ts | 1 + .../js/helpers/__tests__/wellSets.test.ts | 1 + .../createIrregularLabware.test.ts.snap | 4 +- .../__snapshots__/createLabware.test.ts.snap | 4 +- .../createDefaultDisplayName.test.ts | 1 + .../__tests__/createIrregularLabware.test.ts | 2 +- .../__tests__/createLabware.test.ts | 1 + .../fixtures/2/fixture_calibration_block.json | 4 +- 37 files changed, 6022 insertions(+), 18 deletions(-) diff --git a/shared-data/js/__tests__/__snapshots__/pipettes.test.ts.snap b/shared-data/js/__tests__/__snapshots__/pipettes.test.ts.snap index 759bfd6de3d..d014e5b4385 100644 --- a/shared-data/js/__tests__/__snapshots__/pipettes.test.ts.snap +++ b/shared-data/js/__tests__/__snapshots__/pipettes.test.ts.snap @@ -1,4 +1,5972 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`pipette data accessors > getPipetteModelSpecs > model p10_multi_v1 snapshot 1`] = ` +{ + "blowout": { + "max": 10, + "min": -4, + "type": "float", + "units": "mm", + "value": -1, + }, + "bottom": { + "max": 19, + "min": -2, + "type": "float", + "units": "mm", + "value": 2, + }, + "channels": 8, + "defaultAspirateFlowRate": { + "max": 50, + "min": 0.001, + "value": 5, + "valuesByApiLevel": { + "2.0": 5, + }, + }, + "defaultBlowOutFlowRate": { + "max": 1000, + "min": 5, + "value": 1000, + "valuesByApiLevel": { + "2.0": 1000, + }, + }, + "defaultDispenseFlowRate": { + "max": 50, + "min": 0.001, + "value": 10, + "valuesByApiLevel": { + "2.0": 10, + }, + }, + "defaultTipracks": [ + "opentrons/opentrons_96_tiprack_10ul/1", + "opentrons/opentrons_96_filtertiprack_10ul/1", + "opentrons/geb_96_tiprack_10ul/1", + ], + "displayCategory": "GEN1", + "displayName": "P10 8-Channel GEN1", + "dropTip": { + "max": 2, + "min": -6, + "type": "float", + "units": "mm", + "value": -4, + }, + "dropTipCurrent": { + "max": 0.8, + "min": 0.1, + "type": "float", + "units": "amps", + "value": 0.5, + }, + "dropTipSpeed": { + "max": 30, + "min": 0.001, + "type": "float", + "units": "mm/sec", + "value": 5, + }, + "maxVolume": 10, + "minVolume": 1, + "model": "p10_multi_v1", + "modelOffset": [ + 0, + 31.5, + -25.8, + ], + "name": "p10_multi", + "nozzleOffset": [ + 0, + 31.5, + 0.8, + ], + "pickUpCurrent": { + "max": 2, + "min": 0.05, + "type": "float", + "units": "amps", + "value": 0.4, + }, + "pickUpDistance": { + "max": 30, + "min": 1, + "type": "float", + "units": "mm", + "value": 10, + }, + "pickUpIncrement": { + "max": 10, + "min": 0, + "type": "float", + "units": "mm", + "value": 1, + }, + "pickUpPresses": { + "max": 10, + "min": 0, + "type": "int", + "units": "presses", + "value": 3, + }, + "pickUpSpeed": { + "max": 100, + "min": 1, + "type": "float", + "units": "mm/s", + "value": 30, + }, + "plungerCurrent": { + "max": 0.5, + "min": 0.1, + "type": "float", + "units": "amps", + "value": 0.5, + }, + "quirks": [ + "dropTipShake", + ], + "smoothieConfigs": { + "homePosition": 220, + "stepsPerMM": 768, + "travelDistance": 30, + }, + "tipLength": { + "max": 100, + "min": 0, + "type": "float", + "units": "mm", + "value": 33, + }, + "tipOverlap": { + "default": 3.29, + "opentrons/eppendorf_96_tiprack_10ul_eptips/1": 1, + "opentrons/geb_96_tiprack_10ul/1": 6.2, + "opentrons/opentrons_96_filtertiprack_10ul/1": 3.29, + "opentrons/opentrons_96_tiprack_10ul/1": 3.29, + }, + "top": { + "max": 19.5, + "min": 5, + "type": "float", + "units": "mm", + "value": 19.5, + }, + "ulPerMm": [ + { + "aspirate": [ + [ + 1.893415617, + -1.1069, + 3.042593193, + ], + [ + 2.497849452, + -0.1888, + 1.30410391, + ], + [ + 5.649462387, + -0.0081, + 0.8528667891, + ], + [ + 12.74444519, + -0.0018, + 0.8170558891, + ], + ], + "dispense": [ + [ + 12.74444519, + 0, + 0.8058688085, + ], + ], + }, + { + "aspirate": [ + [ + 1.438649211, + 0.01931415115, + 0.691538317, + ], + [ + 1.836824579, + 0.03868955123, + 0.6636639129, + ], + [ + 2.960052684, + 0.00470371018, + 0.7260899411, + ], + [ + 4.487508789, + 0.005175245625, + 0.7246941713, + ], + [ + 10.59661421, + 0.001470408978, + 0.7413196584, + ], + ], + "dispense": [ + [ + 12.74444519, + 0, + 0.8058688085, + ], + ], + }, + ], +} +`; + +exports[`pipette data accessors > getPipetteModelSpecs > model p10_multi_v1.3 snapshot 1`] = ` +{ + "blowout": { + "max": 10, + "min": -4, + "type": "float", + "units": "mm", + "value": -2.5, + }, + "bottom": { + "max": 19, + "min": -2, + "type": "float", + "units": "mm", + "value": 0.5, + }, + "channels": 8, + "defaultAspirateFlowRate": { + "max": 50, + "min": 0.001, + "value": 5, + "valuesByApiLevel": { + "2.0": 5, + }, + }, + "defaultBlowOutFlowRate": { + "max": 1000, + "min": 5, + "value": 1000, + "valuesByApiLevel": { + "2.0": 1000, + }, + }, + "defaultDispenseFlowRate": { + "max": 50, + "min": 0.001, + "value": 10, + "valuesByApiLevel": { + "2.0": 10, + }, + }, + "defaultTipracks": [ + "opentrons/opentrons_96_tiprack_10ul/1", + "opentrons/opentrons_96_filtertiprack_10ul/1", + "opentrons/geb_96_tiprack_10ul/1", + ], + "displayCategory": "GEN1", + "displayName": "P10 8-Channel GEN1", + "dropTip": { + "max": 2, + "min": -6, + "type": "float", + "units": "mm", + "value": -5.5, + }, + "dropTipCurrent": { + "max": 0.8, + "min": 0.1, + "type": "float", + "units": "amps", + "value": 0.5, + }, + "dropTipSpeed": { + "max": 30, + "min": 0.001, + "type": "float", + "units": "mm/sec", + "value": 5, + }, + "maxVolume": 10, + "minVolume": 1, + "model": "p10_multi_v1.3", + "modelOffset": [ + 0, + 31.5, + -25.8, + ], + "name": "p10_multi", + "nozzleOffset": [ + 0, + 31.5, + 0.8, + ], + "pickUpCurrent": { + "max": 2, + "min": 0.05, + "type": "float", + "units": "amps", + "value": 0.4, + }, + "pickUpDistance": { + "max": 30, + "min": 1, + "type": "float", + "units": "mm", + "value": 10, + }, + "pickUpIncrement": { + "max": 10, + "min": 0, + "type": "float", + "units": "mm", + "value": 1, + }, + "pickUpPresses": { + "max": 10, + "min": 0, + "type": "int", + "units": "presses", + "value": 3, + }, + "pickUpSpeed": { + "max": 100, + "min": 1, + "type": "float", + "units": "mm/s", + "value": 30, + }, + "plungerCurrent": { + "max": 0.5, + "min": 0.1, + "type": "float", + "units": "amps", + "value": 0.5, + }, + "quirks": [ + "dropTipShake", + ], + "smoothieConfigs": { + "homePosition": 220, + "stepsPerMM": 768, + "travelDistance": 30, + }, + "tipLength": { + "max": 100, + "min": 0, + "type": "float", + "units": "mm", + "value": 33, + }, + "tipOverlap": { + "default": 3.29, + "opentrons/eppendorf_96_tiprack_10ul_eptips/1": 1, + "opentrons/geb_96_tiprack_10ul/1": 6.2, + "opentrons/opentrons_96_filtertiprack_10ul/1": 3.29, + "opentrons/opentrons_96_tiprack_10ul/1": 3.29, + }, + "top": { + "max": 19.5, + "min": 5, + "type": "float", + "units": "mm", + "value": 19.5, + }, + "ulPerMm": [ + { + "aspirate": [ + [ + 1.893415617, + -1.1069, + 3.042593193, + ], + [ + 2.497849452, + -0.1888, + 1.30410391, + ], + [ + 5.649462387, + -0.0081, + 0.8528667891, + ], + [ + 12.74444519, + -0.0018, + 0.8170558891, + ], + ], + "dispense": [ + [ + 12.74444519, + 0, + 0.8058688085, + ], + ], + }, + { + "aspirate": [ + [ + 1.438649211, + 0.01931415115, + 0.691538317, + ], + [ + 1.836824579, + 0.03868955123, + 0.6636639129, + ], + [ + 2.960052684, + 0.00470371018, + 0.7260899411, + ], + [ + 4.487508789, + 0.005175245625, + 0.7246941713, + ], + [ + 10.59661421, + 0.001470408978, + 0.7413196584, + ], + ], + "dispense": [ + [ + 12.74444519, + 0, + 0.8058688085, + ], + ], + }, + ], +} +`; + +exports[`pipette data accessors > getPipetteModelSpecs > model p10_multi_v1.4 snapshot 1`] = ` +{ + "blowout": { + "max": 10, + "min": -4, + "type": "float", + "units": "mm", + "value": -1, + }, + "bottom": { + "max": 19, + "min": -2, + "type": "float", + "units": "mm", + "value": 2, + }, + "channels": 8, + "defaultAspirateFlowRate": { + "max": 50, + "min": 0.001, + "value": 5, + "valuesByApiLevel": { + "2.0": 5, + }, + }, + "defaultBlowOutFlowRate": { + "max": 1000, + "min": 5, + "value": 1000, + "valuesByApiLevel": { + "2.0": 1000, + }, + }, + "defaultDispenseFlowRate": { + "max": 50, + "min": 0.001, + "value": 10, + "valuesByApiLevel": { + "2.0": 10, + }, + }, + "defaultTipracks": [ + "opentrons/opentrons_96_tiprack_10ul/1", + "opentrons/opentrons_96_filtertiprack_10ul/1", + "opentrons/geb_96_tiprack_10ul/1", + ], + "displayCategory": "GEN1", + "displayName": "P10 8-Channel GEN1", + "dropTip": { + "max": 2, + "min": -6, + "type": "float", + "units": "mm", + "value": -4.5, + }, + "dropTipCurrent": { + "max": 0.8, + "min": 0.1, + "type": "float", + "units": "amps", + "value": 0.5, + }, + "dropTipSpeed": { + "max": 30, + "min": 0.001, + "type": "float", + "units": "mm/sec", + "value": 5, + }, + "maxVolume": 10, + "minVolume": 1, + "model": "p10_multi_v1.4", + "modelOffset": [ + 0, + 31.5, + -25.8, + ], + "name": "p10_multi", + "nozzleOffset": [ + 0, + 31.5, + 0.8, + ], + "pickUpCurrent": { + "max": 2, + "min": 0.05, + "type": "float", + "units": "amps", + "value": 0.4, + }, + "pickUpDistance": { + "max": 30, + "min": 1, + "type": "float", + "units": "mm", + "value": 10, + }, + "pickUpIncrement": { + "max": 10, + "min": 0, + "type": "float", + "units": "mm", + "value": 1, + }, + "pickUpPresses": { + "max": 10, + "min": 0, + "type": "int", + "units": "presses", + "value": 3, + }, + "pickUpSpeed": { + "max": 100, + "min": 1, + "type": "float", + "units": "mm/s", + "value": 30, + }, + "plungerCurrent": { + "max": 0.5, + "min": 0.1, + "type": "float", + "units": "amps", + "value": 0.5, + }, + "quirks": [ + "dropTipShake", + ], + "smoothieConfigs": { + "homePosition": 220, + "stepsPerMM": 768, + "travelDistance": 30, + }, + "tipLength": { + "max": 100, + "min": 0, + "type": "float", + "units": "mm", + "value": 33, + }, + "tipOverlap": { + "default": 3.29, + "opentrons/eppendorf_96_tiprack_10ul_eptips/1": 1, + "opentrons/geb_96_tiprack_10ul/1": 6.2, + "opentrons/opentrons_96_filtertiprack_10ul/1": 3.29, + "opentrons/opentrons_96_tiprack_10ul/1": 3.29, + }, + "top": { + "max": 19.5, + "min": 5, + "type": "float", + "units": "mm", + "value": 19.5, + }, + "ulPerMm": [ + { + "aspirate": [ + [ + 1.893415617, + -1.1069, + 3.042593193, + ], + [ + 2.497849452, + -0.1888, + 1.30410391, + ], + [ + 5.649462387, + -0.0081, + 0.8528667891, + ], + [ + 12.74444519, + -0.0018, + 0.8170558891, + ], + ], + "dispense": [ + [ + 12.74444519, + 0, + 0.8058688085, + ], + ], + }, + { + "aspirate": [ + [ + 1.438649211, + 0.01931415115, + 0.691538317, + ], + [ + 1.836824579, + 0.03868955123, + 0.6636639129, + ], + [ + 2.960052684, + 0.00470371018, + 0.7260899411, + ], + [ + 4.487508789, + 0.005175245625, + 0.7246941713, + ], + [ + 10.59661421, + 0.001470408978, + 0.7413196584, + ], + ], + "dispense": [ + [ + 12.74444519, + 0, + 0.8058688085, + ], + ], + }, + ], +} +`; + +exports[`pipette data accessors > getPipetteModelSpecs > model p10_multi_v1.5 snapshot 1`] = ` +{ + "blowout": { + "max": 10, + "min": -4, + "type": "float", + "units": "mm", + "value": -1, + }, + "bottom": { + "max": 19, + "min": -2, + "type": "float", + "units": "mm", + "value": 2, + }, + "channels": 8, + "defaultAspirateFlowRate": { + "max": 50, + "min": 0.001, + "value": 5, + "valuesByApiLevel": { + "2.0": 5, + }, + }, + "defaultBlowOutFlowRate": { + "max": 1000, + "min": 5, + "value": 1000, + "valuesByApiLevel": { + "2.0": 1000, + }, + }, + "defaultDispenseFlowRate": { + "max": 50, + "min": 0.001, + "value": 10, + "valuesByApiLevel": { + "2.0": 10, + }, + }, + "defaultTipracks": [ + "opentrons/opentrons_96_tiprack_10ul/1", + "opentrons/opentrons_96_filtertiprack_10ul/1", + "opentrons/geb_96_tiprack_10ul/1", + ], + "displayCategory": "GEN1", + "displayName": "P10 8-Channel GEN1", + "dropTip": { + "max": 2, + "min": -6, + "type": "float", + "units": "mm", + "value": -4.5, + }, + "dropTipCurrent": { + "max": 0.8, + "min": 0.1, + "type": "float", + "units": "amps", + "value": 0.5, + }, + "dropTipSpeed": { + "max": 30, + "min": 0.001, + "type": "float", + "units": "mm/sec", + "value": 5, + }, + "maxVolume": 10, + "minVolume": 1, + "model": "p10_multi_v1.5", + "modelOffset": [ + 0, + 31.5, + -25.8, + ], + "name": "p10_multi", + "nozzleOffset": [ + 0, + 31.5, + 0.8, + ], + "pickUpCurrent": { + "max": 2, + "min": 0.05, + "type": "float", + "units": "amps", + "value": 0.55, + }, + "pickUpDistance": { + "max": 30, + "min": 1, + "type": "float", + "units": "mm", + "value": 10, + }, + "pickUpIncrement": { + "max": 10, + "min": 0, + "type": "float", + "units": "mm", + "value": 3, + }, + "pickUpPresses": { + "max": 10, + "min": 0, + "type": "int", + "units": "presses", + "value": 3, + }, + "pickUpSpeed": { + "max": 100, + "min": 1, + "type": "float", + "units": "mm/s", + "value": 30, + }, + "plungerCurrent": { + "max": 0.5, + "min": 0.1, + "type": "float", + "units": "amps", + "value": 0.5, + }, + "quirks": [ + "dropTipShake", + "doubleDropTip", + ], + "smoothieConfigs": { + "homePosition": 220, + "stepsPerMM": 768, + "travelDistance": 30, + }, + "tipLength": { + "max": 100, + "min": 0, + "type": "float", + "units": "mm", + "value": 33, + }, + "tipOverlap": { + "default": 3.29, + "opentrons/eppendorf_96_tiprack_10ul_eptips/1": 1, + "opentrons/geb_96_tiprack_10ul/1": 6.2, + "opentrons/opentrons_96_filtertiprack_10ul/1": 3.29, + "opentrons/opentrons_96_tiprack_10ul/1": 3.29, + }, + "top": { + "max": 19.5, + "min": 5, + "type": "float", + "units": "mm", + "value": 19.5, + }, + "ulPerMm": [ + { + "aspirate": [ + [ + 1.774444444, + -0.1917910448, + 1.2026, + ], + [ + 2.151481481, + -0.0706286837, + 1.0125, + ], + [ + 2.898518519, + -0.04343083788, + 0.954, + ], + [ + 6.373333333, + -0.00905990194, + 0.8544, + ], + [ + 11.00259259, + -0.002325900358, + 0.8115, + ], + ], + "dispense": [ + [ + 12.74444519, + 0, + 0.8058688085, + ], + ], + }, + ], +} +`; + +exports[`pipette data accessors > getPipetteModelSpecs > model p10_single_v1 snapshot 1`] = ` +{ + "blowout": { + "max": 10, + "min": -4, + "type": "float", + "units": "mm", + "value": -1, + }, + "bottom": { + "max": 19, + "min": -2, + "type": "float", + "units": "mm", + "value": 2, + }, + "channels": 1, + "defaultAspirateFlowRate": { + "max": 50, + "min": 0.001, + "value": 5, + "valuesByApiLevel": { + "2.0": 5, + }, + }, + "defaultBlowOutFlowRate": { + "max": 1000, + "min": 5, + "value": 1000, + "valuesByApiLevel": { + "2.0": 1000, + }, + }, + "defaultDispenseFlowRate": { + "max": 50, + "min": 0.001, + "value": 10, + "valuesByApiLevel": { + "2.0": 10, + }, + }, + "defaultTipracks": [ + "opentrons/opentrons_96_tiprack_10ul/1", + "opentrons/opentrons_96_filtertiprack_10ul/1", + "opentrons/geb_96_tiprack_10ul/1", + ], + "displayCategory": "GEN1", + "displayName": "P10 Single-Channel GEN1", + "dropTip": { + "max": 2, + "min": -6, + "type": "float", + "units": "mm", + "value": -4.5, + }, + "dropTipCurrent": { + "max": 0.8, + "min": 0.1, + "type": "float", + "units": "amps", + "value": 0.5, + }, + "dropTipSpeed": { + "max": 30, + "min": 0.001, + "type": "float", + "units": "mm/sec", + "value": 5, + }, + "maxVolume": 10, + "minVolume": 1, + "model": "p10_single_v1", + "modelOffset": [ + 0, + 0, + -13, + ], + "name": "p10_single", + "nozzleOffset": [ + 0, + 0, + 12, + ], + "pickUpCurrent": { + "max": 2, + "min": 0.05, + "type": "float", + "units": "amps", + "value": 0.1, + }, + "pickUpDistance": { + "max": 30, + "min": 1, + "type": "float", + "units": "mm", + "value": 10, + }, + "pickUpIncrement": { + "max": 10, + "min": 0, + "type": "float", + "units": "mm", + "value": 1, + }, + "pickUpPresses": { + "max": 10, + "min": 0, + "type": "int", + "units": "presses", + "value": 3, + }, + "pickUpSpeed": { + "max": 100, + "min": 1, + "type": "float", + "units": "mm/s", + "value": 30, + }, + "plungerCurrent": { + "max": 0.5, + "min": 0.1, + "type": "float", + "units": "amps", + "value": 0.3, + }, + "quirks": [ + "dropTipShake", + ], + "smoothieConfigs": { + "homePosition": 220, + "stepsPerMM": 768, + "travelDistance": 30, + }, + "tipLength": { + "max": 100, + "min": 0, + "type": "float", + "units": "mm", + "value": 33, + }, + "tipOverlap": { + "default": 3.29, + "opentrons/eppendorf_96_tiprack_10ul_eptips/1": 1, + "opentrons/geb_96_tiprack_10ul/1": 6.2, + "opentrons/opentrons_96_filtertiprack_10ul/1": 3.29, + "opentrons/opentrons_96_tiprack_10ul/1": 3.29, + }, + "top": { + "max": 19.5, + "min": 5, + "type": "float", + "units": "mm", + "value": 19.5, + }, + "ulPerMm": [ + { + "aspirate": [ + [ + 1.8263, + -0.0958, + 1.088, + ], + [ + 2.5222, + -0.104, + 1.1031, + ], + [ + 3.2354, + -0.0447, + 0.9536, + ], + [ + 3.9984, + -0.012, + 0.8477, + ], + [ + 12.5135, + -0.0021, + 0.8079, + ], + ], + "dispense": [ + [ + 12.5135, + 0, + 0.7945, + ], + ], + }, + { + "aspirate": [ + [ + 1.438649211, + 0.01931415115, + 0.691538317, + ], + [ + 1.836824579, + 0.03868955123, + 0.6636639129, + ], + [ + 2.960052684, + 0.00470371018, + 0.7260899411, + ], + [ + 4.487508789, + 0.005175245625, + 0.7246941713, + ], + [ + 10.59661421, + 0.001470408978, + 0.7413196584, + ], + ], + "dispense": [ + [ + 12.5135, + 0, + 0.7945, + ], + ], + }, + ], +} +`; + +exports[`pipette data accessors > getPipetteModelSpecs > model p10_single_v1.3 snapshot 1`] = ` +{ + "blowout": { + "max": 10, + "min": -4, + "type": "float", + "units": "mm", + "value": -2.5, + }, + "bottom": { + "max": 19, + "min": -2, + "type": "float", + "units": "mm", + "value": 0.5, + }, + "channels": 1, + "defaultAspirateFlowRate": { + "max": 50, + "min": 0.001, + "value": 5, + "valuesByApiLevel": { + "2.0": 5, + }, + }, + "defaultBlowOutFlowRate": { + "max": 1000, + "min": 5, + "value": 1000, + "valuesByApiLevel": { + "2.0": 1000, + }, + }, + "defaultDispenseFlowRate": { + "max": 50, + "min": 0.001, + "value": 10, + "valuesByApiLevel": { + "2.0": 10, + }, + }, + "defaultTipracks": [ + "opentrons/opentrons_96_tiprack_10ul/1", + "opentrons/opentrons_96_filtertiprack_10ul/1", + "opentrons/geb_96_tiprack_10ul/1", + ], + "displayCategory": "GEN1", + "displayName": "P10 Single-Channel GEN1", + "dropTip": { + "max": 2, + "min": -6, + "type": "float", + "units": "mm", + "value": -6, + }, + "dropTipCurrent": { + "max": 0.8, + "min": 0.1, + "type": "float", + "units": "amps", + "value": 0.5, + }, + "dropTipSpeed": { + "max": 30, + "min": 0.001, + "type": "float", + "units": "mm/sec", + "value": 5, + }, + "maxVolume": 10, + "minVolume": 1, + "model": "p10_single_v1.3", + "modelOffset": [ + 0, + 0, + -13, + ], + "name": "p10_single", + "nozzleOffset": [ + 0, + 0, + 12, + ], + "pickUpCurrent": { + "max": 2, + "min": 0.05, + "type": "float", + "units": "amps", + "value": 0.1, + }, + "pickUpDistance": { + "max": 30, + "min": 1, + "type": "float", + "units": "mm", + "value": 10, + }, + "pickUpIncrement": { + "max": 10, + "min": 0, + "type": "float", + "units": "mm", + "value": 1, + }, + "pickUpPresses": { + "max": 10, + "min": 0, + "type": "int", + "units": "presses", + "value": 3, + }, + "pickUpSpeed": { + "max": 100, + "min": 1, + "type": "float", + "units": "mm/s", + "value": 30, + }, + "plungerCurrent": { + "max": 0.5, + "min": 0.1, + "type": "float", + "units": "amps", + "value": 0.3, + }, + "quirks": [ + "dropTipShake", + ], + "smoothieConfigs": { + "homePosition": 220, + "stepsPerMM": 768, + "travelDistance": 30, + }, + "tipLength": { + "max": 100, + "min": 0, + "type": "float", + "units": "mm", + "value": 33, + }, + "tipOverlap": { + "default": 3.29, + "opentrons/eppendorf_96_tiprack_10ul_eptips/1": 1, + "opentrons/geb_96_tiprack_10ul/1": 6.2, + "opentrons/opentrons_96_filtertiprack_10ul/1": 3.29, + "opentrons/opentrons_96_tiprack_10ul/1": 3.29, + }, + "top": { + "max": 19.5, + "min": 5, + "type": "float", + "units": "mm", + "value": 19.5, + }, + "ulPerMm": [ + { + "aspirate": [ + [ + 1.8263, + -0.0958, + 1.088, + ], + [ + 2.5222, + -0.104, + 1.1031, + ], + [ + 3.2354, + -0.0447, + 0.9536, + ], + [ + 3.9984, + -0.012, + 0.8477, + ], + [ + 12.5135, + -0.0021, + 0.8079, + ], + ], + "dispense": [ + [ + 12.5135, + 0, + 0.7945, + ], + ], + }, + { + "aspirate": [ + [ + 1.438649211, + 0.01931415115, + 0.691538317, + ], + [ + 1.836824579, + 0.03868955123, + 0.6636639129, + ], + [ + 2.960052684, + 0.00470371018, + 0.7260899411, + ], + [ + 4.487508789, + 0.005175245625, + 0.7246941713, + ], + [ + 10.59661421, + 0.001470408978, + 0.7413196584, + ], + ], + "dispense": [ + [ + 12.5135, + 0, + 0.7945, + ], + ], + }, + ], +} +`; + +exports[`pipette data accessors > getPipetteModelSpecs > model p10_single_v1.4 snapshot 1`] = ` +{ + "blowout": { + "max": 10, + "min": -4, + "type": "float", + "units": "mm", + "value": -0.5, + }, + "bottom": { + "max": 19, + "min": -2, + "type": "float", + "units": "mm", + "value": 2.5, + }, + "channels": 1, + "defaultAspirateFlowRate": { + "max": 50, + "min": 0.001, + "value": 5, + "valuesByApiLevel": { + "2.0": 5, + }, + }, + "defaultBlowOutFlowRate": { + "max": 1000, + "min": 5, + "value": 1000, + "valuesByApiLevel": { + "2.0": 1000, + }, + }, + "defaultDispenseFlowRate": { + "max": 50, + "min": 0.001, + "value": 10, + "valuesByApiLevel": { + "2.0": 10, + }, + }, + "defaultTipracks": [ + "opentrons/opentrons_96_tiprack_10ul/1", + "opentrons/opentrons_96_filtertiprack_10ul/1", + "opentrons/geb_96_tiprack_10ul/1", + ], + "displayCategory": "GEN1", + "displayName": "P10 Single-Channel GEN1", + "dropTip": { + "max": 2, + "min": -6, + "type": "float", + "units": "mm", + "value": -5.2, + }, + "dropTipCurrent": { + "max": 0.8, + "min": 0.1, + "type": "float", + "units": "amps", + "value": 0.5, + }, + "dropTipSpeed": { + "max": 30, + "min": 0.001, + "type": "float", + "units": "mm/sec", + "value": 5, + }, + "maxVolume": 10, + "minVolume": 1, + "model": "p10_single_v1.4", + "modelOffset": [ + 0, + 0, + -13, + ], + "name": "p10_single", + "nozzleOffset": [ + 0, + 0, + 12, + ], + "pickUpCurrent": { + "max": 2, + "min": 0.05, + "type": "float", + "units": "amps", + "value": 0.1, + }, + "pickUpDistance": { + "max": 30, + "min": 1, + "type": "float", + "units": "mm", + "value": 10, + }, + "pickUpIncrement": { + "max": 10, + "min": 0, + "type": "float", + "units": "mm", + "value": 1, + }, + "pickUpPresses": { + "max": 10, + "min": 0, + "type": "int", + "units": "presses", + "value": 3, + }, + "pickUpSpeed": { + "max": 100, + "min": 1, + "type": "float", + "units": "mm/s", + "value": 30, + }, + "plungerCurrent": { + "max": 0.5, + "min": 0.1, + "type": "float", + "units": "amps", + "value": 0.3, + }, + "quirks": [ + "dropTipShake", + ], + "smoothieConfigs": { + "homePosition": 220, + "stepsPerMM": 768, + "travelDistance": 30, + }, + "tipLength": { + "max": 100, + "min": 0, + "type": "float", + "units": "mm", + "value": 33, + }, + "tipOverlap": { + "default": 3.29, + "opentrons/eppendorf_96_tiprack_10ul_eptips/1": 1, + "opentrons/geb_96_tiprack_10ul/1": 6.2, + "opentrons/opentrons_96_filtertiprack_10ul/1": 3.29, + "opentrons/opentrons_96_tiprack_10ul/1": 3.29, + }, + "top": { + "max": 19.5, + "min": 5, + "type": "float", + "units": "mm", + "value": 19.5, + }, + "ulPerMm": [ + { + "aspirate": [ + [ + 1.8263, + -0.0958, + 1.088, + ], + [ + 2.5222, + -0.104, + 1.1031, + ], + [ + 3.2354, + -0.0447, + 0.9536, + ], + [ + 3.9984, + -0.012, + 0.8477, + ], + [ + 12.5135, + -0.0021, + 0.8079, + ], + ], + "dispense": [ + [ + 12.5135, + 0, + 0.7945, + ], + ], + }, + { + "aspirate": [ + [ + 1.438649211, + 0.01931415115, + 0.691538317, + ], + [ + 1.836824579, + 0.03868955123, + 0.6636639129, + ], + [ + 2.960052684, + 0.00470371018, + 0.7260899411, + ], + [ + 4.487508789, + 0.005175245625, + 0.7246941713, + ], + [ + 10.59661421, + 0.001470408978, + 0.7413196584, + ], + ], + "dispense": [ + [ + 12.5135, + 0, + 0.7945, + ], + ], + }, + ], +} +`; + +exports[`pipette data accessors > getPipetteModelSpecs > model p10_single_v1.5 snapshot 1`] = ` +{ + "blowout": { + "max": 10, + "min": -4, + "type": "float", + "units": "mm", + "value": -0.5, + }, + "bottom": { + "max": 19, + "min": -2, + "type": "float", + "units": "mm", + "value": 2.5, + }, + "channels": 1, + "defaultAspirateFlowRate": { + "max": 50, + "min": 0.001, + "value": 5, + "valuesByApiLevel": { + "2.0": 5, + }, + }, + "defaultBlowOutFlowRate": { + "max": 1000, + "min": 5, + "value": 1000, + "valuesByApiLevel": { + "2.0": 1000, + }, + }, + "defaultDispenseFlowRate": { + "max": 50, + "min": 0.001, + "value": 10, + "valuesByApiLevel": { + "2.0": 10, + }, + }, + "defaultTipracks": [ + "opentrons/opentrons_96_tiprack_10ul/1", + "opentrons/opentrons_96_filtertiprack_10ul/1", + "opentrons/geb_96_tiprack_10ul/1", + ], + "displayCategory": "GEN1", + "displayName": "P10 Single-Channel GEN1", + "dropTip": { + "max": 2, + "min": -6, + "type": "float", + "units": "mm", + "value": -5.2, + }, + "dropTipCurrent": { + "max": 0.8, + "min": 0.1, + "type": "float", + "units": "amps", + "value": 0.5, + }, + "dropTipSpeed": { + "max": 30, + "min": 0.001, + "type": "float", + "units": "mm/sec", + "value": 5, + }, + "maxVolume": 10, + "minVolume": 1, + "model": "p10_single_v1.5", + "modelOffset": [ + 0, + 0, + -13, + ], + "name": "p10_single", + "nozzleOffset": [ + 0, + 0, + 12, + ], + "pickUpCurrent": { + "max": 2, + "min": 0.05, + "type": "float", + "units": "amps", + "value": 0.1, + }, + "pickUpDistance": { + "max": 30, + "min": 1, + "type": "float", + "units": "mm", + "value": 10, + }, + "pickUpIncrement": { + "max": 10, + "min": 0, + "type": "float", + "units": "mm", + "value": 1, + }, + "pickUpPresses": { + "max": 10, + "min": 0, + "type": "int", + "units": "presses", + "value": 3, + }, + "pickUpSpeed": { + "max": 100, + "min": 1, + "type": "float", + "units": "mm/s", + "value": 30, + }, + "plungerCurrent": { + "max": 0.5, + "min": 0.1, + "type": "float", + "units": "amps", + "value": 0.3, + }, + "quirks": [ + "dropTipShake", + ], + "smoothieConfigs": { + "homePosition": 220, + "stepsPerMM": 768, + "travelDistance": 30, + }, + "tipLength": { + "max": 100, + "min": 0, + "type": "float", + "units": "mm", + "value": 33, + }, + "tipOverlap": { + "default": 3.29, + "opentrons/eppendorf_96_tiprack_10ul_eptips/1": 1, + "opentrons/geb_96_tiprack_10ul/1": 6.2, + "opentrons/opentrons_96_filtertiprack_10ul/1": 3.29, + "opentrons/opentrons_96_tiprack_10ul/1": 3.29, + }, + "top": { + "max": 19.5, + "min": 5, + "type": "float", + "units": "mm", + "value": 19.5, + }, + "ulPerMm": [ + { + "aspirate": [ + [ + 1.553425807, + -0.03427618068, + 0.83, + ], + [ + 1.934976526, + -0.007134812859, + 0.7878, + ], + [ + 2.689843897, + -0.007238069768, + 0.788, + ], + [ + 6.161165493, + 0.0004663523509, + 0.7673, + ], + [ + 10.7963169, + 0.0002200157553, + 0.7688, + ], + ], + "dispense": [ + [ + 12.5135, + 0, + 0.7945, + ], + ], + }, + ], +} +`; + +exports[`pipette data accessors > getPipetteModelSpecs > model p50_multi_v1 snapshot 1`] = ` +{ + "blowout": { + "max": 10, + "min": -4, + "type": "float", + "units": "mm", + "value": 2, + }, + "bottom": { + "max": 19, + "min": -2, + "type": "float", + "units": "mm", + "value": 2.5, + }, + "channels": 8, + "defaultAspirateFlowRate": { + "max": 100, + "min": 0.001, + "value": 25, + "valuesByApiLevel": { + "2.0": 25, + }, + }, + "defaultBlowOutFlowRate": { + "max": 1000, + "min": 5, + "value": 1000, + "valuesByApiLevel": { + "2.0": 1000, + }, + }, + "defaultDispenseFlowRate": { + "max": 100, + "min": 0.001, + "value": 50, + "valuesByApiLevel": { + "2.0": 50, + }, + }, + "defaultTipracks": [ + "opentrons/opentrons_96_tiprack_300ul/1", + "opentrons/opentrons_96_filtertiprack_200ul/1", + ], + "displayCategory": "GEN1", + "displayName": "P50 8-Channel GEN1", + "dropTip": { + "max": 2, + "min": -6, + "type": "float", + "units": "mm", + "value": -3.5, + }, + "dropTipCurrent": { + "max": 0.8, + "min": 0.1, + "type": "float", + "units": "amps", + "value": 0.5, + }, + "dropTipSpeed": { + "max": 30, + "min": 0.001, + "type": "float", + "units": "mm/sec", + "value": 5, + }, + "maxVolume": 50, + "minVolume": 5, + "model": "p50_multi_v1", + "modelOffset": [ + 0, + 31.5, + -25.8, + ], + "name": "p50_multi", + "nozzleOffset": [ + 0, + 31.5, + 0.8, + ], + "pickUpCurrent": { + "max": 2, + "min": 0.05, + "type": "float", + "units": "amps", + "value": 0.6, + }, + "pickUpDistance": { + "max": 30, + "min": 1, + "type": "float", + "units": "mm", + "value": 10, + }, + "pickUpIncrement": { + "max": 10, + "min": 0, + "type": "float", + "units": "mm", + "value": 1, + }, + "pickUpPresses": { + "max": 10, + "min": 0, + "type": "int", + "units": "presses", + "value": 3, + }, + "pickUpSpeed": { + "max": 100, + "min": 1, + "type": "float", + "units": "mm/s", + "value": 30, + }, + "plungerCurrent": { + "max": 0.5, + "min": 0.1, + "type": "float", + "units": "amps", + "value": 0.5, + }, + "quirks": [ + "dropTipShake", + ], + "smoothieConfigs": { + "homePosition": 220, + "stepsPerMM": 768, + "travelDistance": 30, + }, + "tipLength": { + "max": 100, + "min": 0, + "type": "float", + "units": "mm", + "value": 51.7, + }, + "tipOverlap": { + "default": 7.47, + "opentrons/opentrons_96_filtertiprack_200ul/1": 7.47, + "opentrons/opentrons_96_tiprack_300ul/1": 7.47, + "opentrons/tipone_96_tiprack_200ul/1": 6.1, + }, + "top": { + "max": 19.5, + "min": 5, + "type": "float", + "units": "mm", + "value": 19.5, + }, + "ulPerMm": [ + { + "aspirate": [ + [ + 12.29687531, + -0.0049, + 3.134703694, + ], + [ + 50, + -0.0002, + 3.077116024, + ], + ], + "dispense": [ + [ + 50, + 0, + 3.06368702, + ], + ], + }, + { + "aspirate": [ + [ + 5.5768667, + 0.076142366, + 2.363797525, + ], + [ + 7.0999333, + 0.0338396036, + 2.599714392, + ], + [ + 11.5943825, + 0.0130432679, + 2.747366988, + ], + [ + 17.6461325, + 0.007010609879, + 2.817311933, + ], + [ + 50, + 0.002620115513, + 2.894787178, + ], + ], + "dispense": [ + [ + 50, + 0, + 3.06368702, + ], + ], + }, + ], +} +`; + +exports[`pipette data accessors > getPipetteModelSpecs > model p50_multi_v1.3 snapshot 1`] = ` +{ + "blowout": { + "max": 10, + "min": -4, + "type": "float", + "units": "mm", + "value": 0.5, + }, + "bottom": { + "max": 19, + "min": -2, + "type": "float", + "units": "mm", + "value": 2, + }, + "channels": 8, + "defaultAspirateFlowRate": { + "max": 100, + "min": 0.001, + "value": 25, + "valuesByApiLevel": { + "2.0": 25, + }, + }, + "defaultBlowOutFlowRate": { + "max": 1000, + "min": 5, + "value": 1000, + "valuesByApiLevel": { + "2.0": 1000, + }, + }, + "defaultDispenseFlowRate": { + "max": 100, + "min": 0.001, + "value": 50, + "valuesByApiLevel": { + "2.0": 50, + }, + }, + "defaultTipracks": [ + "opentrons/opentrons_96_tiprack_300ul/1", + "opentrons/opentrons_96_filtertiprack_200ul/1", + ], + "displayCategory": "GEN1", + "displayName": "P50 8-Channel GEN1", + "dropTip": { + "max": 2, + "min": -6, + "type": "float", + "units": "mm", + "value": -5, + }, + "dropTipCurrent": { + "max": 0.8, + "min": 0.1, + "type": "float", + "units": "amps", + "value": 0.5, + }, + "dropTipSpeed": { + "max": 30, + "min": 0.001, + "type": "float", + "units": "mm/sec", + "value": 5, + }, + "maxVolume": 50, + "minVolume": 5, + "model": "p50_multi_v1.3", + "modelOffset": [ + 0, + 31.5, + -25.8, + ], + "name": "p50_multi", + "nozzleOffset": [ + 0, + 31.5, + 0.8, + ], + "pickUpCurrent": { + "max": 2, + "min": 0.05, + "type": "float", + "units": "amps", + "value": 0.6, + }, + "pickUpDistance": { + "max": 30, + "min": 1, + "type": "float", + "units": "mm", + "value": 10, + }, + "pickUpIncrement": { + "max": 10, + "min": 0, + "type": "float", + "units": "mm", + "value": 1, + }, + "pickUpPresses": { + "max": 10, + "min": 0, + "type": "int", + "units": "presses", + "value": 3, + }, + "pickUpSpeed": { + "max": 100, + "min": 1, + "type": "float", + "units": "mm/s", + "value": 30, + }, + "plungerCurrent": { + "max": 0.5, + "min": 0.1, + "type": "float", + "units": "amps", + "value": 0.5, + }, + "quirks": [ + "dropTipShake", + ], + "smoothieConfigs": { + "homePosition": 220, + "stepsPerMM": 768, + "travelDistance": 30, + }, + "tipLength": { + "max": 100, + "min": 0, + "type": "float", + "units": "mm", + "value": 51.7, + }, + "tipOverlap": { + "default": 7.47, + "opentrons/opentrons_96_filtertiprack_200ul/1": 7.47, + "opentrons/opentrons_96_tiprack_300ul/1": 7.47, + "opentrons/tipone_96_tiprack_200ul/1": 6.1, + }, + "top": { + "max": 19.5, + "min": 5, + "type": "float", + "units": "mm", + "value": 19.5, + }, + "ulPerMm": [ + { + "aspirate": [ + [ + 12.29687531, + -0.0049, + 3.134703694, + ], + [ + 50, + -0.0002, + 3.077116024, + ], + ], + "dispense": [ + [ + 50, + 0, + 3.06368702, + ], + ], + }, + { + "aspirate": [ + [ + 5.5768667, + 0.076142366, + 2.363797525, + ], + [ + 7.0999333, + 0.0338396036, + 2.599714392, + ], + [ + 11.5943825, + 0.0130432679, + 2.747366988, + ], + [ + 17.6461325, + 0.007010609879, + 2.817311933, + ], + [ + 50, + 0.002620115513, + 2.894787178, + ], + ], + "dispense": [ + [ + 50, + 0, + 3.06368702, + ], + ], + }, + ], +} +`; + +exports[`pipette data accessors > getPipetteModelSpecs > model p50_multi_v1.4 snapshot 1`] = ` +{ + "blowout": { + "max": 10, + "min": -4, + "type": "float", + "units": "mm", + "value": 0.5, + }, + "bottom": { + "max": 19, + "min": -2, + "type": "float", + "units": "mm", + "value": 2, + }, + "channels": 8, + "defaultAspirateFlowRate": { + "max": 100, + "min": 0.001, + "value": 25, + "valuesByApiLevel": { + "2.0": 25, + }, + }, + "defaultBlowOutFlowRate": { + "max": 1000, + "min": 5, + "value": 1000, + "valuesByApiLevel": { + "2.0": 1000, + }, + }, + "defaultDispenseFlowRate": { + "max": 100, + "min": 0.001, + "value": 50, + "valuesByApiLevel": { + "2.0": 50, + }, + }, + "defaultTipracks": [ + "opentrons/opentrons_96_tiprack_300ul/1", + "opentrons/opentrons_96_filtertiprack_200ul/1", + ], + "displayCategory": "GEN1", + "displayName": "P50 8-Channel GEN1", + "dropTip": { + "max": 2, + "min": -6, + "type": "float", + "units": "mm", + "value": -4, + }, + "dropTipCurrent": { + "max": 0.8, + "min": 0.1, + "type": "float", + "units": "amps", + "value": 0.5, + }, + "dropTipSpeed": { + "max": 30, + "min": 0.001, + "type": "float", + "units": "mm/sec", + "value": 5, + }, + "maxVolume": 50, + "minVolume": 5, + "model": "p50_multi_v1.4", + "modelOffset": [ + 0, + 31.5, + -25.8, + ], + "name": "p50_multi", + "nozzleOffset": [ + 0, + 31.5, + 0.8, + ], + "pickUpCurrent": { + "max": 2, + "min": 0.05, + "type": "float", + "units": "amps", + "value": 0.6, + }, + "pickUpDistance": { + "max": 30, + "min": 1, + "type": "float", + "units": "mm", + "value": 10, + }, + "pickUpIncrement": { + "max": 10, + "min": 0, + "type": "float", + "units": "mm", + "value": 1, + }, + "pickUpPresses": { + "max": 10, + "min": 0, + "type": "int", + "units": "presses", + "value": 3, + }, + "pickUpSpeed": { + "max": 100, + "min": 1, + "type": "float", + "units": "mm/s", + "value": 30, + }, + "plungerCurrent": { + "max": 0.5, + "min": 0.1, + "type": "float", + "units": "amps", + "value": 0.5, + }, + "quirks": [ + "dropTipShake", + ], + "smoothieConfigs": { + "homePosition": 220, + "stepsPerMM": 768, + "travelDistance": 30, + }, + "tipLength": { + "max": 100, + "min": 0, + "type": "float", + "units": "mm", + "value": 51.7, + }, + "tipOverlap": { + "default": 7.47, + "opentrons/opentrons_96_filtertiprack_200ul/1": 7.47, + "opentrons/opentrons_96_tiprack_300ul/1": 7.47, + "opentrons/tipone_96_tiprack_200ul/1": 6.1, + }, + "top": { + "max": 19.5, + "min": 5, + "type": "float", + "units": "mm", + "value": 19.5, + }, + "ulPerMm": [ + { + "aspirate": [ + [ + 12.29687531, + -0.0049, + 3.134703694, + ], + [ + 50, + -0.0002, + 3.077116024, + ], + ], + "dispense": [ + [ + 50, + 0, + 3.06368702, + ], + ], + }, + { + "aspirate": [ + [ + 5.5768667, + 0.076142366, + 2.363797525, + ], + [ + 7.0999333, + 0.0338396036, + 2.599714392, + ], + [ + 11.5943825, + 0.0130432679, + 2.747366988, + ], + [ + 17.6461325, + 0.007010609879, + 2.817311933, + ], + [ + 50, + 0.002620115513, + 2.894787178, + ], + ], + "dispense": [ + [ + 50, + 0, + 3.06368702, + ], + ], + }, + ], +} +`; + +exports[`pipette data accessors > getPipetteModelSpecs > model p50_multi_v1.5 snapshot 1`] = ` +{ + "blowout": { + "max": 10, + "min": -4, + "type": "float", + "units": "mm", + "value": 0.5, + }, + "bottom": { + "max": 19, + "min": -2, + "type": "float", + "units": "mm", + "value": 2, + }, + "channels": 8, + "defaultAspirateFlowRate": { + "max": 100, + "min": 0.001, + "value": 25, + "valuesByApiLevel": { + "2.0": 25, + }, + }, + "defaultBlowOutFlowRate": { + "max": 1000, + "min": 5, + "value": 1000, + "valuesByApiLevel": { + "2.0": 1000, + }, + }, + "defaultDispenseFlowRate": { + "max": 100, + "min": 0.001, + "value": 50, + "valuesByApiLevel": { + "2.0": 50, + }, + }, + "defaultTipracks": [ + "opentrons/opentrons_96_tiprack_300ul/1", + "opentrons/opentrons_96_filtertiprack_200ul/1", + ], + "displayCategory": "GEN1", + "displayName": "P50 8-Channel GEN1", + "dropTip": { + "max": 2, + "min": -6, + "type": "float", + "units": "mm", + "value": -4, + }, + "dropTipCurrent": { + "max": 0.8, + "min": 0.1, + "type": "float", + "units": "amps", + "value": 0.5, + }, + "dropTipSpeed": { + "max": 30, + "min": 0.001, + "type": "float", + "units": "mm/sec", + "value": 5, + }, + "maxVolume": 50, + "minVolume": 5, + "model": "p50_multi_v1.5", + "modelOffset": [ + 0, + 31.5, + -25.8, + ], + "name": "p50_multi", + "nozzleOffset": [ + 0, + 31.5, + 0.8, + ], + "pickUpCurrent": { + "max": 2, + "min": 0.05, + "type": "float", + "units": "amps", + "value": 0.8, + }, + "pickUpDistance": { + "max": 30, + "min": 1, + "type": "float", + "units": "mm", + "value": 10, + }, + "pickUpIncrement": { + "max": 10, + "min": 0, + "type": "float", + "units": "mm", + "value": 3, + }, + "pickUpPresses": { + "max": 10, + "min": 0, + "type": "int", + "units": "presses", + "value": 3, + }, + "pickUpSpeed": { + "max": 100, + "min": 1, + "type": "float", + "units": "mm/s", + "value": 30, + }, + "plungerCurrent": { + "max": 0.5, + "min": 0.1, + "type": "float", + "units": "amps", + "value": 0.5, + }, + "quirks": [ + "dropTipShake", + "doubleDropTip", + ], + "smoothieConfigs": { + "homePosition": 220, + "stepsPerMM": 768, + "travelDistance": 30, + }, + "tipLength": { + "max": 100, + "min": 0, + "type": "float", + "units": "mm", + "value": 51.7, + }, + "tipOverlap": { + "default": 7.47, + "opentrons/opentrons_96_filtertiprack_200ul/1": 7.47, + "opentrons/opentrons_96_tiprack_300ul/1": 7.47, + "opentrons/tipone_96_tiprack_200ul/1": 6.1, + }, + "top": { + "max": 19.5, + "min": 5, + "type": "float", + "units": "mm", + "value": 19.5, + }, + "ulPerMm": [ + { + "aspirate": [ + [ + 6.190392157, + -0.01092438778, + 3.1628, + ], + [ + 7.639705882, + -0.02712575255, + 3.2631, + ], + [ + 10.69666667, + 0.0001007939816, + 3.0551, + ], + [ + 24.49343137, + 0.0003978066956, + 3.0519, + ], + [ + 50, + -0.00001501363238, + 3.062, + ], + ], + "dispense": [ + [ + 50, + 0, + 3.06368702, + ], + ], + }, + ], +} +`; + +exports[`pipette data accessors > getPipetteModelSpecs > model p50_single_v1 snapshot 1`] = ` +{ + "blowout": { + "max": 10, + "min": -4, + "type": "float", + "units": "mm", + "value": 2, + }, + "bottom": { + "max": 19, + "min": -2, + "type": "float", + "units": "mm", + "value": 2.01, + }, + "channels": 1, + "defaultAspirateFlowRate": { + "max": 100, + "min": 0.001, + "value": 25, + "valuesByApiLevel": { + "2.0": 25, + }, + }, + "defaultBlowOutFlowRate": { + "max": 1000, + "min": 5, + "value": 1000, + "valuesByApiLevel": { + "2.0": 1000, + }, + }, + "defaultDispenseFlowRate": { + "max": 100, + "min": 0.001, + "value": 50, + "valuesByApiLevel": { + "2.0": 50, + }, + }, + "defaultTipracks": [ + "opentrons/opentrons_96_tiprack_300ul/1", + "opentrons/opentrons_96_filtertiprack_200ul/1", + ], + "displayCategory": "GEN1", + "displayName": "P50 Single-Channel GEN1", + "dropTip": { + "max": 2, + "min": -6, + "type": "float", + "units": "mm", + "value": -4.5, + }, + "dropTipCurrent": { + "max": 0.8, + "min": 0.1, + "type": "float", + "units": "amps", + "value": 0.5, + }, + "dropTipSpeed": { + "max": 30, + "min": 0.001, + "type": "float", + "units": "mm/sec", + "value": 5, + }, + "maxVolume": 50, + "minVolume": 5, + "model": "p50_single_v1", + "modelOffset": [ + 0, + 0, + 0, + ], + "name": "p50_single", + "nozzleOffset": [ + 0, + 0, + 25, + ], + "pickUpCurrent": { + "max": 2, + "min": 0.05, + "type": "float", + "units": "amps", + "value": 0.1, + }, + "pickUpDistance": { + "max": 30, + "min": 1, + "type": "float", + "units": "mm", + "value": 10, + }, + "pickUpIncrement": { + "max": 10, + "min": 0, + "type": "float", + "units": "mm", + "value": 1, + }, + "pickUpPresses": { + "max": 10, + "min": 0, + "type": "int", + "units": "presses", + "value": 3, + }, + "pickUpSpeed": { + "max": 100, + "min": 1, + "type": "float", + "units": "mm/s", + "value": 30, + }, + "plungerCurrent": { + "max": 0.5, + "min": 0.1, + "type": "float", + "units": "amps", + "value": 0.3, + }, + "quirks": [ + "dropTipShake", + ], + "smoothieConfigs": { + "homePosition": 220, + "stepsPerMM": 768, + "travelDistance": 30, + }, + "tipLength": { + "max": 100, + "min": 0, + "type": "float", + "units": "mm", + "value": 51.7, + }, + "tipOverlap": { + "default": 7.47, + "opentrons/opentrons_96_filtertiprack_200ul/1": 7.47, + "opentrons/opentrons_96_tiprack_300ul/1": 7.47, + "opentrons/tipone_96_tiprack_200ul/1": 6.1, + }, + "top": { + "max": 19.5, + "min": 5, + "type": "float", + "units": "mm", + "value": 19.5, + }, + "ulPerMm": [ + { + "aspirate": [ + [ + 11.79687499, + -0.0098, + 3.064988953, + ], + [ + 50, + -0.0004, + 2.954068131, + ], + ], + "dispense": [ + [ + 50, + 0, + 2.931601299, + ], + ], + }, + { + "aspirate": [ + [ + 5.538952382, + 0.04994568474, + 2.492829422, + ], + [ + 7.050333334, + 0.0335171238, + 2.583826438, + ], + [ + 11.5397619, + 0.01443549911, + 2.718358253, + ], + [ + 17.55071427, + 0.006684226987, + 2.807806088, + ], + [ + 50, + 0.001789563193, + 2.893710933, + ], + ], + "dispense": [ + [ + 50, + 0, + 2.931601299, + ], + ], + }, + ], +} +`; + +exports[`pipette data accessors > getPipetteModelSpecs > model p50_single_v1.3 snapshot 1`] = ` +{ + "blowout": { + "max": 10, + "min": -4, + "type": "float", + "units": "mm", + "value": 0.5, + }, + "bottom": { + "max": 19, + "min": -2, + "type": "float", + "units": "mm", + "value": 2, + }, + "channels": 1, + "defaultAspirateFlowRate": { + "max": 100, + "min": 0.001, + "value": 25, + "valuesByApiLevel": { + "2.0": 25, + }, + }, + "defaultBlowOutFlowRate": { + "max": 1000, + "min": 5, + "value": 1000, + "valuesByApiLevel": { + "2.0": 1000, + }, + }, + "defaultDispenseFlowRate": { + "max": 100, + "min": 0.001, + "value": 50, + "valuesByApiLevel": { + "2.0": 50, + }, + }, + "defaultTipracks": [ + "opentrons/opentrons_96_tiprack_300ul/1", + "opentrons/opentrons_96_filtertiprack_200ul/1", + ], + "displayCategory": "GEN1", + "displayName": "P50 Single-Channel GEN1", + "dropTip": { + "max": 2, + "min": -6, + "type": "float", + "units": "mm", + "value": -6, + }, + "dropTipCurrent": { + "max": 0.8, + "min": 0.1, + "type": "float", + "units": "amps", + "value": 0.5, + }, + "dropTipSpeed": { + "max": 30, + "min": 0.001, + "type": "float", + "units": "mm/sec", + "value": 5, + }, + "maxVolume": 50, + "minVolume": 5, + "model": "p50_single_v1.3", + "modelOffset": [ + 0, + 0, + 0, + ], + "name": "p50_single", + "nozzleOffset": [ + 0, + 0, + 25, + ], + "pickUpCurrent": { + "max": 2, + "min": 0.05, + "type": "float", + "units": "amps", + "value": 0.1, + }, + "pickUpDistance": { + "max": 30, + "min": 1, + "type": "float", + "units": "mm", + "value": 10, + }, + "pickUpIncrement": { + "max": 10, + "min": 0, + "type": "float", + "units": "mm", + "value": 1, + }, + "pickUpPresses": { + "max": 10, + "min": 0, + "type": "int", + "units": "presses", + "value": 3, + }, + "pickUpSpeed": { + "max": 100, + "min": 1, + "type": "float", + "units": "mm/s", + "value": 30, + }, + "plungerCurrent": { + "max": 0.5, + "min": 0.1, + "type": "float", + "units": "amps", + "value": 0.3, + }, + "quirks": [ + "dropTipShake", + ], + "smoothieConfigs": { + "homePosition": 220, + "stepsPerMM": 768, + "travelDistance": 30, + }, + "tipLength": { + "max": 100, + "min": 0, + "type": "float", + "units": "mm", + "value": 51.7, + }, + "tipOverlap": { + "default": 7.47, + "opentrons/opentrons_96_filtertiprack_200ul/1": 7.47, + "opentrons/opentrons_96_tiprack_300ul/1": 7.47, + "opentrons/tipone_96_tiprack_200ul/1": 6.1, + }, + "top": { + "max": 19.5, + "min": 5, + "type": "float", + "units": "mm", + "value": 19.5, + }, + "ulPerMm": [ + { + "aspirate": [ + [ + 11.79687499, + -0.0098, + 3.064988953, + ], + [ + 50, + -0.0004, + 2.954068131, + ], + ], + "dispense": [ + [ + 50, + 0, + 2.931601299, + ], + ], + }, + { + "aspirate": [ + [ + 5.538952382, + 0.04994568474, + 2.492829422, + ], + [ + 7.050333334, + 0.0335171238, + 2.583826438, + ], + [ + 11.5397619, + 0.01443549911, + 2.718358253, + ], + [ + 17.55071427, + 0.006684226987, + 2.807806088, + ], + [ + 50, + 0.001789563193, + 2.893710933, + ], + ], + "dispense": [ + [ + 50, + 0, + 2.931601299, + ], + ], + }, + ], +} +`; + +exports[`pipette data accessors > getPipetteModelSpecs > model p50_single_v1.4 snapshot 1`] = ` +{ + "blowout": { + "max": 10, + "min": -4, + "type": "float", + "units": "mm", + "value": 0.5, + }, + "bottom": { + "max": 19, + "min": -2, + "type": "float", + "units": "mm", + "value": 2, + }, + "channels": 1, + "defaultAspirateFlowRate": { + "max": 100, + "min": 0.001, + "value": 25, + "valuesByApiLevel": { + "2.0": 25, + }, + }, + "defaultBlowOutFlowRate": { + "max": 1000, + "min": 5, + "value": 1000, + "valuesByApiLevel": { + "2.0": 1000, + }, + }, + "defaultDispenseFlowRate": { + "max": 100, + "min": 0.001, + "value": 50, + "valuesByApiLevel": { + "2.0": 50, + }, + }, + "defaultTipracks": [ + "opentrons/opentrons_96_tiprack_300ul/1", + "opentrons/opentrons_96_filtertiprack_200ul/1", + ], + "displayCategory": "GEN1", + "displayName": "P50 Single-Channel GEN1", + "dropTip": { + "max": 2, + "min": -6, + "type": "float", + "units": "mm", + "value": -5, + }, + "dropTipCurrent": { + "max": 0.8, + "min": 0.1, + "type": "float", + "units": "amps", + "value": 0.5, + }, + "dropTipSpeed": { + "max": 30, + "min": 0.001, + "type": "float", + "units": "mm/sec", + "value": 5, + }, + "maxVolume": 50, + "minVolume": 5, + "model": "p50_single_v1.4", + "modelOffset": [ + 0, + 0, + 0, + ], + "name": "p50_single", + "nozzleOffset": [ + 0, + 0, + 25, + ], + "pickUpCurrent": { + "max": 2, + "min": 0.05, + "type": "float", + "units": "amps", + "value": 0.1, + }, + "pickUpDistance": { + "max": 30, + "min": 1, + "type": "float", + "units": "mm", + "value": 10, + }, + "pickUpIncrement": { + "max": 10, + "min": 0, + "type": "float", + "units": "mm", + "value": 1, + }, + "pickUpPresses": { + "max": 10, + "min": 0, + "type": "int", + "units": "presses", + "value": 3, + }, + "pickUpSpeed": { + "max": 100, + "min": 1, + "type": "float", + "units": "mm/s", + "value": 30, + }, + "plungerCurrent": { + "max": 0.5, + "min": 0.1, + "type": "float", + "units": "amps", + "value": 0.3, + }, + "quirks": [ + "dropTipShake", + ], + "smoothieConfigs": { + "homePosition": 220, + "stepsPerMM": 768, + "travelDistance": 30, + }, + "tipLength": { + "max": 100, + "min": 0, + "type": "float", + "units": "mm", + "value": 51.7, + }, + "tipOverlap": { + "default": 7.47, + "opentrons/opentrons_96_filtertiprack_200ul/1": 7.47, + "opentrons/opentrons_96_tiprack_300ul/1": 7.47, + "opentrons/tipone_96_tiprack_200ul/1": 6.1, + }, + "top": { + "max": 19.5, + "min": 5, + "type": "float", + "units": "mm", + "value": 19.5, + }, + "ulPerMm": [ + { + "aspirate": [ + [ + 11.79687499, + -0.0098, + 3.064988953, + ], + [ + 50, + -0.0004, + 2.954068131, + ], + ], + "dispense": [ + [ + 50, + 0, + 2.931601299, + ], + ], + }, + { + "aspirate": [ + [ + 5.538952382, + 0.04994568474, + 2.492829422, + ], + [ + 7.050333334, + 0.0335171238, + 2.583826438, + ], + [ + 11.5397619, + 0.01443549911, + 2.718358253, + ], + [ + 17.55071427, + 0.006684226987, + 2.807806088, + ], + [ + 50, + 0.001789563193, + 2.893710933, + ], + ], + "dispense": [ + [ + 50, + 0, + 2.931601299, + ], + ], + }, + ], +} +`; + +exports[`pipette data accessors > getPipetteModelSpecs > model p300_multi_v1 snapshot 1`] = ` +{ + "blowout": { + "max": 10, + "min": -4, + "type": "float", + "units": "mm", + "value": 3, + }, + "bottom": { + "max": 19, + "min": -2, + "type": "float", + "units": "mm", + "value": 3.5, + }, + "channels": 8, + "defaultAspirateFlowRate": { + "max": 600, + "min": 0.001, + "value": 150, + "valuesByApiLevel": { + "2.0": 150, + }, + }, + "defaultBlowOutFlowRate": { + "max": 1000, + "min": 5, + "value": 1000, + "valuesByApiLevel": { + "2.0": 1000, + }, + }, + "defaultDispenseFlowRate": { + "max": 600, + "min": 0.001, + "value": 300, + "valuesByApiLevel": { + "2.0": 300, + }, + }, + "defaultTipracks": [ + "opentrons/opentrons_96_tiprack_300ul/1", + "opentrons/opentrons_96_filtertiprack_200ul/1", + ], + "displayCategory": "GEN1", + "displayName": "P300 8-Channel GEN1", + "dropTip": { + "max": 2, + "min": -6, + "type": "float", + "units": "mm", + "value": -2, + }, + "dropTipCurrent": { + "max": 0.8, + "min": 0.1, + "type": "float", + "units": "amps", + "value": 0.5, + }, + "dropTipSpeed": { + "max": 30, + "min": 0.001, + "type": "float", + "units": "mm/sec", + "value": 5, + }, + "maxVolume": 300, + "minVolume": 30, + "model": "p300_multi_v1", + "modelOffset": [ + 0, + 31.5, + -25.8, + ], + "name": "p300_multi", + "nozzleOffset": [ + 0, + 31.5, + 0.8, + ], + "pickUpCurrent": { + "max": 2, + "min": 0.05, + "type": "float", + "units": "amps", + "value": 0.6, + }, + "pickUpDistance": { + "max": 30, + "min": 1, + "type": "float", + "units": "mm", + "value": 10, + }, + "pickUpIncrement": { + "max": 10, + "min": 0, + "type": "float", + "units": "mm", + "value": 1, + }, + "pickUpPresses": { + "max": 10, + "min": 0, + "type": "int", + "units": "presses", + "value": 3, + }, + "pickUpSpeed": { + "max": 100, + "min": 1, + "type": "float", + "units": "mm/s", + "value": 30, + }, + "plungerCurrent": { + "max": 0.5, + "min": 0.1, + "type": "float", + "units": "amps", + "value": 0.5, + }, + "quirks": [ + "dropTipShake", + ], + "smoothieConfigs": { + "homePosition": 220, + "stepsPerMM": 768, + "travelDistance": 30, + }, + "tipLength": { + "max": 100, + "min": 0, + "type": "float", + "units": "mm", + "value": 51.7, + }, + "tipOverlap": { + "default": 7.47, + "opentrons/opentrons_96_filtertiprack_200ul/1": 7.47, + "opentrons/opentrons_96_tiprack_300ul/1": 7.47, + "opentrons/tipone_96_tiprack_200ul/1": 6.1, + }, + "top": { + "max": 19.5, + "min": 5, + "type": "float", + "units": "mm", + "value": 19.5, + }, + "ulPerMm": [ + { + "aspirate": [ + [ + 57.25698968, + 0.017, + 18.132, + ], + [ + 309.2612689, + 0.001, + 19.03, + ], + ], + "dispense": [ + [ + 309.2612689, + 0, + 19.29389273, + ], + ], + }, + ], +} +`; + +exports[`pipette data accessors > getPipetteModelSpecs > model p300_multi_v1.3 snapshot 1`] = ` +{ + "blowout": { + "max": 10, + "min": -4, + "type": "float", + "units": "mm", + "value": 1.5, + }, + "bottom": { + "max": 19, + "min": -2, + "type": "float", + "units": "mm", + "value": 3.5, + }, + "channels": 8, + "defaultAspirateFlowRate": { + "max": 600, + "min": 0.001, + "value": 150, + "valuesByApiLevel": { + "2.0": 150, + }, + }, + "defaultBlowOutFlowRate": { + "max": 1000, + "min": 5, + "value": 1000, + "valuesByApiLevel": { + "2.0": 1000, + }, + }, + "defaultDispenseFlowRate": { + "max": 600, + "min": 0.001, + "value": 300, + "valuesByApiLevel": { + "2.0": 300, + }, + }, + "defaultTipracks": [ + "opentrons/opentrons_96_tiprack_300ul/1", + "opentrons/opentrons_96_filtertiprack_200ul/1", + ], + "displayCategory": "GEN1", + "displayName": "P300 8-Channel GEN1", + "dropTip": { + "max": 2, + "min": -6, + "type": "float", + "units": "mm", + "value": -3.5, + }, + "dropTipCurrent": { + "max": 0.8, + "min": 0.1, + "type": "float", + "units": "amps", + "value": 0.5, + }, + "dropTipSpeed": { + "max": 30, + "min": 0.001, + "type": "float", + "units": "mm/sec", + "value": 5, + }, + "maxVolume": 300, + "minVolume": 30, + "model": "p300_multi_v1.3", + "modelOffset": [ + 0, + 31.5, + -25.8, + ], + "name": "p300_multi", + "nozzleOffset": [ + 0, + 31.5, + 0.8, + ], + "pickUpCurrent": { + "max": 2, + "min": 0.05, + "type": "float", + "units": "amps", + "value": 0.6, + }, + "pickUpDistance": { + "max": 30, + "min": 1, + "type": "float", + "units": "mm", + "value": 10, + }, + "pickUpIncrement": { + "max": 10, + "min": 0, + "type": "float", + "units": "mm", + "value": 1, + }, + "pickUpPresses": { + "max": 10, + "min": 0, + "type": "int", + "units": "presses", + "value": 3, + }, + "pickUpSpeed": { + "max": 100, + "min": 1, + "type": "float", + "units": "mm/s", + "value": 30, + }, + "plungerCurrent": { + "max": 0.5, + "min": 0.1, + "type": "float", + "units": "amps", + "value": 0.5, + }, + "quirks": [ + "dropTipShake", + ], + "smoothieConfigs": { + "homePosition": 220, + "stepsPerMM": 768, + "travelDistance": 30, + }, + "tipLength": { + "max": 100, + "min": 0, + "type": "float", + "units": "mm", + "value": 51.7, + }, + "tipOverlap": { + "default": 7.47, + "opentrons/opentrons_96_filtertiprack_200ul/1": 7.47, + "opentrons/opentrons_96_tiprack_300ul/1": 7.47, + "opentrons/tipone_96_tiprack_200ul/1": 6.1, + }, + "top": { + "max": 19.5, + "min": 5, + "type": "float", + "units": "mm", + "value": 19.5, + }, + "ulPerMm": [ + { + "aspirate": [ + [ + 57.25698968, + 0.017, + 18.132, + ], + [ + 309.2612689, + 0.001, + 19.03, + ], + ], + "dispense": [ + [ + 309.2612689, + 0, + 19.29389273, + ], + ], + }, + ], +} +`; + +exports[`pipette data accessors > getPipetteModelSpecs > model p300_multi_v1.4 snapshot 1`] = ` +{ + "blowout": { + "max": 10, + "min": -4, + "type": "float", + "units": "mm", + "value": 1.5, + }, + "bottom": { + "max": 19, + "min": -2, + "type": "float", + "units": "mm", + "value": 3.5, + }, + "channels": 8, + "defaultAspirateFlowRate": { + "max": 600, + "min": 0.001, + "value": 150, + "valuesByApiLevel": { + "2.0": 150, + }, + }, + "defaultBlowOutFlowRate": { + "max": 1000, + "min": 5, + "value": 1000, + "valuesByApiLevel": { + "2.0": 1000, + }, + }, + "defaultDispenseFlowRate": { + "max": 600, + "min": 0.001, + "value": 300, + "valuesByApiLevel": { + "2.0": 300, + }, + }, + "defaultTipracks": [ + "opentrons/opentrons_96_tiprack_300ul/1", + "opentrons/opentrons_96_filtertiprack_200ul/1", + ], + "displayCategory": "GEN1", + "displayName": "P300 8-Channel GEN1", + "dropTip": { + "max": 2, + "min": -6, + "type": "float", + "units": "mm", + "value": -3.5, + }, + "dropTipCurrent": { + "max": 0.8, + "min": 0.1, + "type": "float", + "units": "amps", + "value": 0.5, + }, + "dropTipSpeed": { + "max": 30, + "min": 0.001, + "type": "float", + "units": "mm", + "value": 5, + }, + "maxVolume": 300, + "minVolume": 30, + "model": "p300_multi_v1.4", + "modelOffset": [ + 0, + 31.5, + -25.8, + ], + "name": "p300_multi", + "nozzleOffset": [ + 0, + 31.5, + 0.8, + ], + "pickUpCurrent": { + "max": 2, + "min": 0.05, + "type": "float", + "units": "amps", + "value": 0.6, + }, + "pickUpDistance": { + "max": 30, + "min": 1, + "type": "float", + "units": "mm", + "value": 10, + }, + "pickUpIncrement": { + "max": 10, + "min": 0, + "type": "float", + "units": "mm", + "value": 1, + }, + "pickUpPresses": { + "max": 10, + "min": 0, + "type": "int", + "units": "presses", + "value": 3, + }, + "pickUpSpeed": { + "max": 100, + "min": 1, + "type": "float", + "units": "mm/s", + "value": 30, + }, + "plungerCurrent": { + "max": 0.5, + "min": 0.1, + "type": "float", + "units": "amps", + "value": 0.5, + }, + "quirks": [ + "dropTipShake", + ], + "smoothieConfigs": { + "homePosition": 220, + "stepsPerMM": 768, + "travelDistance": 30, + }, + "tipLength": { + "max": 100, + "min": 0, + "type": "float", + "units": "mm", + "value": 51.7, + }, + "tipOverlap": { + "default": 7.47, + "opentrons/opentrons_96_filtertiprack_200ul/1": 7.47, + "opentrons/opentrons_96_tiprack_300ul/1": 7.47, + "opentrons/tipone_96_tiprack_200ul/1": 6.1, + }, + "top": { + "max": 19.5, + "min": 5, + "type": "float", + "units": "mm", + "value": 19.5, + }, + "ulPerMm": [ + { + "aspirate": [ + [ + 57.25698968, + 0.017, + 18.132, + ], + [ + 309.2612689, + 0.001, + 19.03, + ], + ], + "dispense": [ + [ + 309.2612689, + 0, + 19.29389273, + ], + ], + }, + ], +} +`; + +exports[`pipette data accessors > getPipetteModelSpecs > model p300_multi_v1.5 snapshot 1`] = ` +{ + "blowout": { + "max": 10, + "min": -4, + "type": "float", + "units": "mm", + "value": 1.5, + }, + "bottom": { + "max": 19, + "min": -2, + "type": "float", + "units": "mm", + "value": 3.5, + }, + "channels": 8, + "defaultAspirateFlowRate": { + "max": 600, + "min": 0.001, + "value": 150, + "valuesByApiLevel": { + "2.0": 150, + }, + }, + "defaultBlowOutFlowRate": { + "max": 1000, + "min": 5, + "value": 1000, + "valuesByApiLevel": { + "2.0": 1000, + }, + }, + "defaultDispenseFlowRate": { + "max": 600, + "min": 0.001, + "value": 300, + "valuesByApiLevel": { + "2.0": 300, + }, + }, + "defaultTipracks": [ + "opentrons/opentrons_96_tiprack_300ul/1", + "opentrons/opentrons_96_filtertiprack_200ul/1", + ], + "displayCategory": "GEN1", + "displayName": "P300 8-Channel GEN1", + "dropTip": { + "max": 2, + "min": -6, + "type": "float", + "units": "mm", + "value": -3.5, + }, + "dropTipCurrent": { + "max": 0.8, + "min": 0.1, + "type": "float", + "units": "amps", + "value": 0.5, + }, + "dropTipSpeed": { + "max": 30, + "min": 0.001, + "type": "float", + "units": "mm", + "value": 5, + }, + "maxVolume": 300, + "minVolume": 30, + "model": "p300_multi_v1.5", + "modelOffset": [ + 0, + 31.5, + -25.8, + ], + "name": "p300_multi", + "nozzleOffset": [ + 0, + 31.5, + 0.8, + ], + "pickUpCurrent": { + "max": 2, + "min": 0.05, + "type": "float", + "units": "amps", + "value": 0.9, + }, + "pickUpDistance": { + "max": 30, + "min": 1, + "type": "float", + "units": "mm", + "value": 10, + }, + "pickUpIncrement": { + "max": 10, + "min": 0, + "type": "float", + "units": "mm", + "value": 3, + }, + "pickUpPresses": { + "max": 10, + "min": 0, + "type": "int", + "units": "presses", + "value": 3, + }, + "pickUpSpeed": { + "max": 100, + "min": 1, + "type": "float", + "units": "mm/s", + "value": 30, + }, + "plungerCurrent": { + "max": 0.5, + "min": 0.1, + "type": "float", + "units": "amps", + "value": 0.5, + }, + "quirks": [ + "dropTipShake", + "doubleDropTip", + ], + "smoothieConfigs": { + "homePosition": 220, + "stepsPerMM": 768, + "travelDistance": 30, + }, + "tipLength": { + "max": 100, + "min": 0, + "type": "float", + "units": "mm", + "value": 51.7, + }, + "tipOverlap": { + "default": 7.47, + "opentrons/opentrons_96_filtertiprack_200ul/1": 7.47, + "opentrons/opentrons_96_tiprack_300ul/1": 7.47, + "opentrons/tipone_96_tiprack_200ul/1": 6.1, + }, + "top": { + "max": 19.5, + "min": 5, + "type": "float", + "units": "mm", + "value": 19.5, + }, + "ulPerMm": [ + { + "aspirate": [ + [ + 57.25698968, + 0.017, + 18.132, + ], + [ + 309.2612689, + 0.001, + 19.03, + ], + ], + "dispense": [ + [ + 309.2612689, + 0, + 19.29389273, + ], + ], + }, + ], +} +`; + +exports[`pipette data accessors > getPipetteModelSpecs > model p300_single_v1 snapshot 1`] = ` +{ + "blowout": { + "max": 10, + "min": -4, + "type": "float", + "units": "mm", + "value": 0, + }, + "bottom": { + "max": 19, + "min": -2, + "type": "float", + "units": "mm", + "value": 1.5, + }, + "channels": 1, + "defaultAspirateFlowRate": { + "max": 600, + "min": 0.001, + "value": 150, + "valuesByApiLevel": { + "2.0": 150, + }, + }, + "defaultBlowOutFlowRate": { + "max": 1000, + "min": 5, + "value": 1000, + "valuesByApiLevel": { + "2.0": 1000, + }, + }, + "defaultDispenseFlowRate": { + "max": 600, + "min": 0.001, + "value": 300, + "valuesByApiLevel": { + "2.0": 300, + }, + }, + "defaultTipracks": [ + "opentrons/opentrons_96_tiprack_300ul/1", + "opentrons/opentrons_96_filtertiprack_200ul/1", + ], + "displayCategory": "GEN1", + "displayName": "P300 Single-Channel GEN1", + "dropTip": { + "max": 2, + "min": -6, + "type": "float", + "units": "mm", + "value": -4, + }, + "dropTipCurrent": { + "max": 0.8, + "min": 0.1, + "type": "float", + "units": "amps", + "value": 0.5, + }, + "dropTipSpeed": { + "max": 30, + "min": 0.001, + "type": "float", + "units": "mm/sec", + "value": 5, + }, + "maxVolume": 300, + "minVolume": 30, + "model": "p300_single_v1", + "modelOffset": [ + 0, + 0, + 0, + ], + "name": "p300_single", + "nozzleOffset": [ + 0, + 0, + 25, + ], + "pickUpCurrent": { + "max": 2, + "min": 0.05, + "type": "float", + "units": "amps", + "value": 0.1, + }, + "pickUpDistance": { + "max": 30, + "min": 1, + "type": "float", + "units": "mm", + "value": 10, + }, + "pickUpIncrement": { + "max": 10, + "min": 0, + "type": "float", + "units": "mm", + "value": 1, + }, + "pickUpPresses": { + "max": 10, + "min": 0, + "type": "int", + "units": "presses", + "value": 3, + }, + "pickUpSpeed": { + "max": 100, + "min": 1, + "type": "float", + "units": "mm/s", + "value": 30, + }, + "plungerCurrent": { + "max": 0.5, + "min": 0.1, + "type": "float", + "units": "amps", + "value": 0.3, + }, + "quirks": [ + "dropTipShake", + ], + "smoothieConfigs": { + "homePosition": 220, + "stepsPerMM": 768, + "travelDistance": 30, + }, + "tipLength": { + "max": 100, + "min": 0, + "type": "float", + "units": "mm", + "value": 51.7, + }, + "tipOverlap": { + "default": 7.47, + "opentrons/opentrons_96_filtertiprack_200ul/1": 7.47, + "opentrons/opentrons_96_tiprack_300ul/1": 7.47, + "opentrons/tipone_96_tiprack_200ul/1": 6.1, + }, + "top": { + "max": 19.5, + "min": 5, + "type": "float", + "units": "mm", + "value": 19.5, + }, + "ulPerMm": [ + { + "aspirate": [ + [ + 36.19844973, + 0.043, + 16.548, + ], + [ + 54.98518519, + 0.012, + 17.658, + ], + [ + 73.90077516, + 0.008, + 17.902, + ], + [ + 111.8437953, + 0.004, + 18.153, + ], + [ + 302.3895337, + 0.001, + 18.23, + ], + ], + "dispense": [ + [ + 302.3895337, + 0, + 18.83156277, + ], + ], + }, + { + "aspirate": [ + [ + 53.958, + 0.0252, + 16.6268, + ], + [ + 73.0217, + 0.0141, + 17.2234, + ], + [ + 82.6834, + 0.0123, + 17.3586, + ], + [ + 120.7877, + 0.0055, + 17.9214, + ], + [ + 197.3909, + 0.0028, + 18.2415, + ], + [ + 300, + 0.0014, + 18.5235, + ], + ], + "dispense": [ + [ + 302.3895337, + 0, + 18.83156277, + ], + ], + }, + ], +} +`; + +exports[`pipette data accessors > getPipetteModelSpecs > model p300_single_v1.3 snapshot 1`] = ` +{ + "blowout": { + "max": 10, + "min": -4, + "type": "float", + "units": "mm", + "value": -1.5, + }, + "bottom": { + "max": 19, + "min": -2, + "type": "float", + "units": "mm", + "value": 1.5, + }, + "channels": 1, + "defaultAspirateFlowRate": { + "max": 600, + "min": 0.001, + "value": 150, + "valuesByApiLevel": { + "2.0": 150, + }, + }, + "defaultBlowOutFlowRate": { + "max": 1000, + "min": 5, + "value": 1000, + "valuesByApiLevel": { + "2.0": 1000, + }, + }, + "defaultDispenseFlowRate": { + "max": 600, + "min": 0.001, + "value": 300, + "valuesByApiLevel": { + "2.0": 300, + }, + }, + "defaultTipracks": [ + "opentrons/opentrons_96_tiprack_300ul/1", + "opentrons/opentrons_96_filtertiprack_200ul/1", + ], + "displayCategory": "GEN1", + "displayName": "P300 Single-Channel GEN1", + "dropTip": { + "max": 2, + "min": -6, + "type": "float", + "units": "mm", + "value": -5.5, + }, + "dropTipCurrent": { + "max": 0.8, + "min": 0.1, + "type": "float", + "units": "amps", + "value": 0.5, + }, + "dropTipSpeed": { + "max": 30, + "min": 0.001, + "type": "float", + "units": "mm/sec", + "value": 5, + }, + "maxVolume": 300, + "minVolume": 30, + "model": "p300_single_v1.3", + "modelOffset": [ + 0, + 0, + 0, + ], + "name": "p300_single", + "nozzleOffset": [ + 0, + 0, + 25, + ], + "pickUpCurrent": { + "max": 2, + "min": 0.05, + "type": "float", + "units": "amps", + "value": 0.1, + }, + "pickUpDistance": { + "max": 30, + "min": 1, + "type": "float", + "units": "mm", + "value": 10, + }, + "pickUpIncrement": { + "max": 10, + "min": 0, + "type": "float", + "units": "mm", + "value": 1, + }, + "pickUpPresses": { + "max": 10, + "min": 0, + "type": "int", + "units": "presses", + "value": 3, + }, + "pickUpSpeed": { + "max": 100, + "min": 1, + "type": "float", + "units": "mm/s", + "value": 30, + }, + "plungerCurrent": { + "max": 0.5, + "min": 0.1, + "type": "float", + "units": "amps", + "value": 0.3, + }, + "quirks": [ + "dropTipShake", + ], + "smoothieConfigs": { + "homePosition": 220, + "stepsPerMM": 768, + "travelDistance": 30, + }, + "tipLength": { + "max": 100, + "min": 0, + "type": "float", + "units": "mm", + "value": 51.7, + }, + "tipOverlap": { + "default": 7.47, + "opentrons/opentrons_96_filtertiprack_200ul/1": 7.47, + "opentrons/opentrons_96_tiprack_300ul/1": 7.47, + "opentrons/tipone_96_tiprack_200ul/1": 6.1, + }, + "top": { + "max": 19.5, + "min": 5, + "type": "float", + "units": "mm", + "value": 19.5, + }, + "ulPerMm": [ + { + "aspirate": [ + [ + 36.19844973, + 0.043, + 16.548, + ], + [ + 54.98518519, + 0.012, + 17.658, + ], + [ + 73.90077516, + 0.008, + 17.902, + ], + [ + 111.8437953, + 0.004, + 18.153, + ], + [ + 302.3895337, + 0.001, + 18.23, + ], + ], + "dispense": [ + [ + 302.3895337, + 0, + 18.83156277, + ], + ], + }, + { + "aspirate": [ + [ + 53.958, + 0.0252, + 16.6268, + ], + [ + 73.0217, + 0.0141, + 17.2234, + ], + [ + 82.6834, + 0.0123, + 17.3586, + ], + [ + 120.7877, + 0.0055, + 17.9214, + ], + [ + 197.3909, + 0.0028, + 18.2415, + ], + [ + 300, + 0.0014, + 18.5235, + ], + ], + "dispense": [ + [ + 302.3895337, + 0, + 18.83156277, + ], + ], + }, + ], +} +`; + +exports[`pipette data accessors > getPipetteModelSpecs > model p300_single_v1.4 snapshot 1`] = ` +{ + "blowout": { + "max": 10, + "min": -4, + "type": "float", + "units": "mm", + "value": 0, + }, + "bottom": { + "max": 19, + "min": -2, + "type": "float", + "units": "mm", + "value": 3, + }, + "channels": 1, + "defaultAspirateFlowRate": { + "max": 600, + "min": 0.001, + "value": 150, + "valuesByApiLevel": { + "2.0": 150, + }, + }, + "defaultBlowOutFlowRate": { + "max": 1000, + "min": 5, + "value": 1000, + "valuesByApiLevel": { + "2.0": 1000, + }, + }, + "defaultDispenseFlowRate": { + "max": 600, + "min": 0.001, + "value": 300, + "valuesByApiLevel": { + "2.0": 300, + }, + }, + "defaultTipracks": [ + "opentrons/opentrons_96_tiprack_300ul/1", + "opentrons/opentrons_96_filtertiprack_200ul/1", + ], + "displayCategory": "GEN1", + "displayName": "P300 Single-Channel GEN1", + "dropTip": { + "max": 2, + "min": -6, + "type": "float", + "units": "mm", + "value": -4.5, + }, + "dropTipCurrent": { + "max": 0.8, + "min": 0.1, + "type": "float", + "units": "amps", + "value": 0.5, + }, + "dropTipSpeed": { + "max": 30, + "min": 0.001, + "type": "float", + "units": "mm/sec", + "value": 5, + }, + "maxVolume": 300, + "minVolume": 30, + "model": "p300_single_v1.4", + "modelOffset": [ + 0, + 0, + 0, + ], + "name": "p300_single", + "nozzleOffset": [ + 0, + 0, + 25, + ], + "pickUpCurrent": { + "max": 2, + "min": 0.05, + "type": "float", + "units": "amps", + "value": 0.1, + }, + "pickUpDistance": { + "max": 30, + "min": 1, + "type": "float", + "units": "mm", + "value": 10, + }, + "pickUpIncrement": { + "max": 10, + "min": 0, + "type": "float", + "units": "mm", + "value": 1, + }, + "pickUpPresses": { + "max": 10, + "min": 0, + "type": "int", + "units": "presses", + "value": 3, + }, + "pickUpSpeed": { + "max": 100, + "min": 1, + "type": "float", + "units": "mm/s", + "value": 30, + }, + "plungerCurrent": { + "max": 0.5, + "min": 0.1, + "type": "float", + "units": "amps", + "value": 0.3, + }, + "quirks": [ + "dropTipShake", + ], + "smoothieConfigs": { + "homePosition": 220, + "stepsPerMM": 768, + "travelDistance": 30, + }, + "tipLength": { + "max": 100, + "min": 0, + "type": "float", + "units": "mm", + "value": 51.7, + }, + "tipOverlap": { + "default": 7.47, + "opentrons/opentrons_96_filtertiprack_200ul/1": 7.47, + "opentrons/opentrons_96_tiprack_300ul/1": 7.47, + "opentrons/tipone_96_tiprack_200ul/1": 6.1, + }, + "top": { + "max": 19.5, + "min": 5, + "type": "float", + "units": "mm", + "value": 19.5, + }, + "ulPerMm": [ + { + "aspirate": [ + [ + 36.19844973, + 0.043, + 16.548, + ], + [ + 54.98518519, + 0.012, + 17.658, + ], + [ + 73.90077516, + 0.008, + 17.902, + ], + [ + 111.8437953, + 0.004, + 18.153, + ], + [ + 302.3895337, + 0.001, + 18.23, + ], + ], + "dispense": [ + [ + 302.3895337, + 0, + 18.83156277, + ], + ], + }, + { + "aspirate": [ + [ + 53.958, + 0.0252, + 16.6268, + ], + [ + 73.0217, + 0.0141, + 17.2234, + ], + [ + 82.6834, + 0.0123, + 17.3586, + ], + [ + 120.7877, + 0.0055, + 17.9214, + ], + [ + 197.3909, + 0.0028, + 18.2415, + ], + [ + 300, + 0.0014, + 18.5235, + ], + ], + "dispense": [ + [ + 302.3895337, + 0, + 18.83156277, + ], + ], + }, + ], +} +`; + +exports[`pipette data accessors > getPipetteModelSpecs > model p300_single_v1.5 snapshot 1`] = ` +{ + "blowout": { + "max": 10, + "min": -4, + "type": "float", + "units": "mm", + "value": 0, + }, + "bottom": { + "max": 19, + "min": -2, + "type": "float", + "units": "mm", + "value": 3, + }, + "channels": 1, + "defaultAspirateFlowRate": { + "max": 600, + "min": 0.001, + "value": 150, + "valuesByApiLevel": { + "2.0": 150, + }, + }, + "defaultBlowOutFlowRate": { + "max": 1000, + "min": 5, + "value": 1000, + "valuesByApiLevel": { + "2.0": 1000, + }, + }, + "defaultDispenseFlowRate": { + "max": 600, + "min": 0.001, + "value": 300, + "valuesByApiLevel": { + "2.0": 300, + }, + }, + "defaultTipracks": [ + "opentrons/opentrons_96_tiprack_300ul/1", + "opentrons/opentrons_96_filtertiprack_200ul/1", + ], + "displayCategory": "GEN1", + "displayName": "P300 Single-Channel GEN1", + "dropTip": { + "max": 2, + "min": -6, + "type": "float", + "units": "mm", + "value": -4.5, + }, + "dropTipCurrent": { + "max": 0.8, + "min": 0.1, + "type": "float", + "units": "amps", + "value": 0.5, + }, + "dropTipSpeed": { + "max": 30, + "min": 0.001, + "type": "float", + "units": "mm/sec", + "value": 5, + }, + "maxVolume": 300, + "minVolume": 30, + "model": "p300_single_v1.5", + "modelOffset": [ + 0, + 0, + 0, + ], + "name": "p300_single", + "nozzleOffset": [ + 0, + 0, + 25, + ], + "pickUpCurrent": { + "max": 2, + "min": 0.05, + "type": "float", + "units": "amps", + "value": 0.1, + }, + "pickUpDistance": { + "max": 30, + "min": 1, + "type": "float", + "units": "mm", + "value": 10, + }, + "pickUpIncrement": { + "max": 10, + "min": 0, + "type": "float", + "units": "mm", + "value": 1, + }, + "pickUpPresses": { + "max": 10, + "min": 0, + "type": "int", + "units": "presses", + "value": 3, + }, + "pickUpSpeed": { + "max": 100, + "min": 1, + "type": "float", + "units": "mm/s", + "value": 30, + }, + "plungerCurrent": { + "max": 0.5, + "min": 0.1, + "type": "float", + "units": "amps", + "value": 0.3, + }, + "quirks": [ + "dropTipShake", + ], + "smoothieConfigs": { + "homePosition": 220, + "stepsPerMM": 768, + "travelDistance": 30, + }, + "tipLength": { + "max": 100, + "min": 0, + "type": "float", + "units": "mm", + "value": 51.7, + }, + "tipOverlap": { + "default": 7.47, + "opentrons/opentrons_96_filtertiprack_200ul/1": 7.47, + "opentrons/opentrons_96_tiprack_300ul/1": 7.47, + "opentrons/tipone_96_tiprack_200ul/1": 6.1, + }, + "top": { + "max": 19.5, + "min": 5, + "type": "float", + "units": "mm", + "value": 19.5, + }, + "ulPerMm": [ + { + "aspirate": [ + [ + 35.11266179, + 0.03721315938, + 16.2497, + ], + [ + 44.37338506, + 0.02084320206, + 16.8245, + ], + [ + 63.12001468, + 0.01519931266, + 17.0749, + ], + [ + 148.3020792, + 0.005910516464, + 17.6612, + ], + [ + 224.5387262, + 0.00227975152, + 18.1997, + ], + [ + 301.049323, + 0.001359578667, + 18.4063, + ], + ], + "dispense": [ + [ + 302.3895337, + 0, + 18.83156277, + ], + ], + }, + ], +} +`; + +exports[`pipette data accessors > getPipetteModelSpecs > model p1000_single_v1 snapshot 1`] = ` +{ + "blowout": { + "max": 10, + "min": -4, + "type": "float", + "units": "mm", + "value": 1, + }, + "bottom": { + "max": 19, + "min": -2, + "type": "float", + "units": "mm", + "value": 3, + }, + "channels": 1, + "defaultAspirateFlowRate": { + "max": 2000, + "min": 50, + "value": 500, + "valuesByApiLevel": { + "2.0": 500, + }, + }, + "defaultBlowOutFlowRate": { + "max": 1000, + "min": 5, + "value": 1000, + "valuesByApiLevel": { + "2.0": 1000, + }, + }, + "defaultDispenseFlowRate": { + "max": 2000, + "min": 50, + "value": 1000, + "valuesByApiLevel": { + "2.0": 1000, + }, + }, + "defaultTipracks": [ + "opentrons/opentrons_96_tiprack_1000ul/1", + "opentrons/opentrons_96_filtertiprack_1000ul/1", + "opentrons/geb_96_tiprack_1000ul/1", + ], + "displayCategory": "GEN1", + "displayName": "P1000 Single-Channel GEN1", + "dropTip": { + "max": 2, + "min": -6, + "type": "float", + "units": "mm", + "value": -2.2, + }, + "dropTipCurrent": { + "max": 0.8, + "min": 0.1, + "type": "float", + "units": "amps", + "value": 0.5, + }, + "dropTipSpeed": { + "max": 30, + "min": 0.001, + "type": "float", + "units": "mm/sec", + "value": 5, + }, + "maxVolume": 1000, + "minVolume": 100, + "model": "p1000_single_v1", + "modelOffset": [ + 0, + 0, + 20, + ], + "name": "p1000_single", + "nozzleOffset": [ + 0, + 0, + 45, + ], + "pickUpCurrent": { + "max": 2, + "min": 0.05, + "type": "float", + "units": "amps", + "value": 0.1, + }, + "pickUpDistance": { + "max": 30, + "min": 1, + "type": "float", + "units": "mm", + "value": 15, + }, + "pickUpIncrement": { + "max": 10, + "min": 0, + "type": "float", + "units": "mm", + "value": 1, + }, + "pickUpPresses": { + "max": 10, + "min": 0, + "type": "int", + "units": "presses", + "value": 3, + }, + "pickUpSpeed": { + "max": 100, + "min": 1, + "type": "float", + "units": "mm/s", + "value": 30, + }, + "plungerCurrent": { + "max": 0.5, + "min": 0.1, + "type": "float", + "units": "amps", + "value": 0.5, + }, + "quirks": [ + "pickupTipShake", + "dropTipShake", + ], + "smoothieConfigs": { + "homePosition": 220, + "stepsPerMM": 768, + "travelDistance": 30, + }, + "tipLength": { + "max": 100, + "min": 0, + "type": "float", + "units": "mm", + "value": 76.7, + }, + "tipOverlap": { + "default": 7.95, + "opentrons/eppendorf_96_tiprack_1000ul_eptips/1": 0, + "opentrons/geb_96_tiprack_1000ul/1": 11.2, + "opentrons/opentrons_96_filtertiprack_1000ul/1": 7.95, + "opentrons/opentrons_96_tiprack_1000ul/1": 7.95, + }, + "top": { + "max": 19.5, + "min": 5, + "type": "float", + "units": "mm", + "value": 19.5, + }, + "ulPerMm": [ + { + "aspirate": [ + [ + 148.9157, + 0.0213, + 56.3986, + ], + [ + 210.8237, + 0.0108, + 57.9568, + ], + [ + 241.2405, + 0.0025, + 59.717, + ], + [ + 365.2719, + 0.0046, + 59.2043, + ], + [ + 614.4871, + 0.0023, + 60.0431, + ], + [ + 1000, + 0.001, + 60.8209, + ], + ], + "dispense": [ + [ + 1000, + 0, + 61.3275, + ], + ], + }, + ], +} +`; + +exports[`pipette data accessors > getPipetteModelSpecs > model p1000_single_v1.3 snapshot 1`] = ` +{ + "blowout": { + "max": 10, + "min": -4, + "type": "float", + "units": "mm", + "value": 0.5, + }, + "bottom": { + "max": 19, + "min": -2, + "type": "float", + "units": "mm", + "value": 2.5, + }, + "channels": 1, + "defaultAspirateFlowRate": { + "max": 2000, + "min": 50, + "value": 500, + "valuesByApiLevel": { + "2.0": 500, + }, + }, + "defaultBlowOutFlowRate": { + "max": 1000, + "min": 5, + "value": 1000, + "valuesByApiLevel": { + "2.0": 1000, + }, + }, + "defaultDispenseFlowRate": { + "max": 2000, + "min": 50, + "value": 1000, + "valuesByApiLevel": { + "2.0": 1000, + }, + }, + "defaultTipracks": [ + "opentrons/opentrons_96_tiprack_1000ul/1", + "opentrons/opentrons_96_filtertiprack_1000ul/1", + "opentrons/geb_96_tiprack_1000ul/1", + ], + "displayCategory": "GEN1", + "displayName": "P1000 Single-Channel GEN1", + "dropTip": { + "max": 2, + "min": -6, + "type": "float", + "units": "mm", + "value": -4, + }, + "dropTipCurrent": { + "max": 0.8, + "min": 0.1, + "type": "float", + "units": "amps", + "value": 0.7, + }, + "dropTipSpeed": { + "max": 30, + "min": 0.001, + "type": "float", + "units": "mm/sec", + "value": 5, + }, + "maxVolume": 1000, + "minVolume": 100, + "model": "p1000_single_v1.3", + "modelOffset": [ + 0, + 0, + 20, + ], + "name": "p1000_single", + "nozzleOffset": [ + 0, + 0, + 45, + ], + "pickUpCurrent": { + "max": 2, + "min": 0.05, + "type": "float", + "units": "amps", + "value": 0.1, + }, + "pickUpDistance": { + "max": 30, + "min": 1, + "type": "float", + "units": "mm", + "value": 15, + }, + "pickUpIncrement": { + "max": 10, + "min": 0, + "type": "float", + "units": "mm", + "value": 1, + }, + "pickUpPresses": { + "max": 10, + "min": 0, + "type": "int", + "units": "presses", + "value": 3, + }, + "pickUpSpeed": { + "max": 100, + "min": 1, + "type": "float", + "units": "mm/s", + "value": 30, + }, + "plungerCurrent": { + "max": 0.5, + "min": 0.1, + "type": "float", + "units": "amps", + "value": 0.5, + }, + "quirks": [ + "pickupTipShake", + "dropTipShake", + ], + "smoothieConfigs": { + "homePosition": 220, + "stepsPerMM": 768, + "travelDistance": 30, + }, + "tipLength": { + "max": 100, + "min": 0, + "type": "float", + "units": "mm", + "value": 76.7, + }, + "tipOverlap": { + "default": 7.95, + "opentrons/eppendorf_96_tiprack_1000ul_eptips/1": 0, + "opentrons/geb_96_tiprack_1000ul/1": 11.2, + "opentrons/opentrons_96_filtertiprack_1000ul/1": 7.95, + "opentrons/opentrons_96_tiprack_1000ul/1": 7.95, + }, + "top": { + "max": 19.5, + "min": 5, + "type": "float", + "units": "mm", + "value": 19.5, + }, + "ulPerMm": [ + { + "aspirate": [ + [ + 148.9157, + 0.0213, + 56.3986, + ], + [ + 210.8237, + 0.0108, + 57.9568, + ], + [ + 241.2405, + 0.0025, + 59.717, + ], + [ + 365.2719, + 0.0046, + 59.2043, + ], + [ + 614.4871, + 0.0023, + 60.0431, + ], + [ + 1000, + 0.001, + 60.8209, + ], + ], + "dispense": [ + [ + 1000, + 0, + 61.3275, + ], + ], + }, + ], +} +`; + +exports[`pipette data accessors > getPipetteModelSpecs > model p1000_single_v1.4 snapshot 1`] = ` +{ + "blowout": { + "max": 10, + "min": -4, + "type": "float", + "units": "mm", + "value": 0.5, + }, + "bottom": { + "max": 19, + "min": -2, + "type": "float", + "units": "mm", + "value": 2.5, + }, + "channels": 1, + "defaultAspirateFlowRate": { + "max": 2000, + "min": 50, + "value": 500, + "valuesByApiLevel": { + "2.0": 500, + }, + }, + "defaultBlowOutFlowRate": { + "max": 1000, + "min": 5, + "value": 1000, + "valuesByApiLevel": { + "2.0": 1000, + }, + }, + "defaultDispenseFlowRate": { + "max": 2000, + "min": 50, + "value": 1000, + "valuesByApiLevel": { + "2.0": 1000, + }, + }, + "defaultTipracks": [ + "opentrons/opentrons_96_tiprack_1000ul/1", + "opentrons/opentrons_96_filtertiprack_1000ul/1", + "opentrons/geb_96_tiprack_1000ul/1", + ], + "displayCategory": "GEN1", + "displayName": "P1000 Single-Channel GEN1", + "dropTip": { + "max": 2, + "min": -6, + "type": "float", + "units": "mm", + "value": -4, + }, + "dropTipCurrent": { + "max": 0.8, + "min": 0.1, + "type": "float", + "units": "amps", + "value": 0.7, + }, + "dropTipSpeed": { + "max": 30, + "min": 0.001, + "type": "float", + "units": "mm/sec", + "value": 5, + }, + "maxVolume": 1000, + "minVolume": 100, + "model": "p1000_single_v1.4", + "modelOffset": [ + 0, + 0, + 20, + ], + "name": "p1000_single", + "nozzleOffset": [ + 0, + 0, + 45, + ], + "pickUpCurrent": { + "max": 2, + "min": 0.05, + "type": "float", + "units": "amps", + "value": 0.1, + }, + "pickUpDistance": { + "max": 30, + "min": 1, + "type": "float", + "units": "mm", + "value": 15, + }, + "pickUpIncrement": { + "max": 10, + "min": 0, + "type": "float", + "units": "mm", + "value": 1, + }, + "pickUpPresses": { + "max": 10, + "min": 0, + "type": "int", + "units": "presses", + "value": 3, + }, + "pickUpSpeed": { + "max": 100, + "min": 1, + "type": "float", + "units": "mm/s", + "value": 30, + }, + "plungerCurrent": { + "max": 0.5, + "min": 0.1, + "type": "float", + "units": "amps", + "value": 0.5, + }, + "quirks": [ + "pickupTipShake", + "dropTipShake", + ], + "smoothieConfigs": { + "homePosition": 220, + "stepsPerMM": 768, + "travelDistance": 30, + }, + "tipLength": { + "max": 100, + "min": 0, + "type": "float", + "units": "mm", + "value": 76.7, + }, + "tipOverlap": { + "default": 7.95, + "opentrons/eppendorf_96_tiprack_1000ul_eptips/1": 0, + "opentrons/geb_96_tiprack_1000ul/1": 11.2, + "opentrons/opentrons_96_filtertiprack_1000ul/1": 7.95, + "opentrons/opentrons_96_tiprack_1000ul/1": 7.95, + }, + "top": { + "max": 19.5, + "min": 5, + "type": "float", + "units": "mm", + "value": 19.5, + }, + "ulPerMm": [ + { + "aspirate": [ + [ + 148.9157, + 0.0213, + 56.3986, + ], + [ + 210.8237, + 0.0108, + 57.9568, + ], + [ + 241.2405, + 0.0025, + 59.717, + ], + [ + 365.2719, + 0.0046, + 59.2043, + ], + [ + 614.4871, + 0.0023, + 60.0431, + ], + [ + 1000, + 0.001, + 60.8209, + ], + ], + "dispense": [ + [ + 1000, + 0, + 61.3275, + ], + ], + }, + ], +} +`; + +exports[`pipette data accessors > getPipetteModelSpecs > model p1000_single_v1.5 snapshot 1`] = ` +{ + "blowout": { + "max": 10, + "min": -4, + "type": "float", + "units": "mm", + "value": 0.5, + }, + "bottom": { + "max": 19, + "min": -2, + "type": "float", + "units": "mm", + "value": 2.5, + }, + "channels": 1, + "defaultAspirateFlowRate": { + "max": 2000, + "min": 50, + "value": 500, + "valuesByApiLevel": { + "2.0": 500, + }, + }, + "defaultBlowOutFlowRate": { + "max": 1000, + "min": 5, + "value": 1000, + "valuesByApiLevel": { + "2.0": 1000, + }, + }, + "defaultDispenseFlowRate": { + "max": 2000, + "min": 50, + "value": 1000, + "valuesByApiLevel": { + "2.0": 1000, + }, + }, + "defaultTipracks": [ + "opentrons/opentrons_96_tiprack_1000ul/1", + "opentrons/opentrons_96_filtertiprack_1000ul/1", + "opentrons/geb_96_tiprack_1000ul/1", + ], + "displayCategory": "GEN1", + "displayName": "P1000 Single-Channel GEN1", + "dropTip": { + "max": 2, + "min": -6, + "type": "float", + "units": "mm", + "value": -4, + }, + "dropTipCurrent": { + "max": 0.8, + "min": 0.1, + "type": "float", + "units": "amps", + "value": 0.7, + }, + "dropTipSpeed": { + "max": 30, + "min": 0.001, + "type": "float", + "units": "mm/sec", + "value": 5, + }, + "maxVolume": 1000, + "minVolume": 100, + "model": "p1000_single_v1.5", + "modelOffset": [ + 0, + 0, + 20, + ], + "name": "p1000_single", + "nozzleOffset": [ + 0, + 0, + 45, + ], + "pickUpCurrent": { + "max": 2, + "min": 0.05, + "type": "float", + "units": "amps", + "value": 0.15, + }, + "pickUpDistance": { + "max": 30, + "min": 1, + "type": "float", + "units": "mm", + "value": 15, + }, + "pickUpIncrement": { + "max": 10, + "min": 0, + "type": "float", + "units": "mm", + "value": 1, + }, + "pickUpPresses": { + "max": 10, + "min": 0, + "type": "int", + "units": "presses", + "value": 3, + }, + "pickUpSpeed": { + "max": 100, + "min": 1, + "type": "float", + "units": "mm/s", + "value": 30, + }, + "plungerCurrent": { + "max": 0.5, + "min": 0.1, + "type": "float", + "units": "amps", + "value": 0.5, + }, + "quirks": [ + "pickupTipShake", + "dropTipShake", + ], + "smoothieConfigs": { + "homePosition": 220, + "stepsPerMM": 768, + "travelDistance": 30, + }, + "tipLength": { + "max": 100, + "min": 0, + "type": "float", + "units": "mm", + "value": 76.7, + }, + "tipOverlap": { + "default": 7.95, + "opentrons/eppendorf_96_tiprack_1000ul_eptips/1": 0, + "opentrons/geb_96_tiprack_1000ul/1": 11.2, + "opentrons/opentrons_96_filtertiprack_1000ul/1": 7.95, + "opentrons/opentrons_96_tiprack_1000ul/1": 7.95, + }, + "top": { + "max": 19.5, + "min": 5, + "type": "float", + "units": "mm", + "value": 19.5, + }, + "ulPerMm": [ + { + "aspirate": [ + [ + 148.9157, + 0.0213, + 56.3986, + ], + [ + 210.8237, + 0.0108, + 57.9568, + ], + [ + 241.2405, + 0.0025, + 59.717, + ], + [ + 365.2719, + 0.0046, + 59.2043, + ], + [ + 614.4871, + 0.0023, + 60.0431, + ], + [ + 1000, + 0.001, + 60.8209, + ], + ], + "dispense": [ + [ + 1000, + 0, + 61.3275, + ], + ], + }, + ], +} +`; + +exports[`pipette data accessors > getPipetteNameSpecs > name p10_multi snapshot 1`] = ` +{ + "channels": 8, + "defaultAspirateFlowRate": { + "max": 50, + "min": 0.001, + "value": 5, + "valuesByApiLevel": { + "2.0": 5, + }, + }, + "defaultBlowOutFlowRate": { + "max": 1000, + "min": 5, + "value": 1000, + "valuesByApiLevel": { + "2.0": 1000, + }, + }, + "defaultDispenseFlowRate": { + "max": 50, + "min": 0.001, + "value": 10, + "valuesByApiLevel": { + "2.0": 10, + }, + }, + "defaultTipracks": [ + "opentrons/opentrons_96_tiprack_10ul/1", + "opentrons/opentrons_96_filtertiprack_10ul/1", + "opentrons/geb_96_tiprack_10ul/1", + ], + "displayCategory": "GEN1", + "displayName": "P10 8-Channel GEN1", + "maxVolume": 10, + "minVolume": 1, + "name": "p10_multi", + "smoothieConfigs": { + "homePosition": 220, + "stepsPerMM": 768, + "travelDistance": 30, + }, +} +`; + +exports[`pipette data accessors > getPipetteNameSpecs > name p10_single snapshot 1`] = ` +{ + "channels": 1, + "defaultAspirateFlowRate": { + "max": 50, + "min": 0.001, + "value": 5, + "valuesByApiLevel": { + "2.0": 5, + }, + }, + "defaultBlowOutFlowRate": { + "max": 1000, + "min": 5, + "value": 1000, + "valuesByApiLevel": { + "2.0": 1000, + }, + }, + "defaultDispenseFlowRate": { + "max": 50, + "min": 0.001, + "value": 10, + "valuesByApiLevel": { + "2.0": 10, + }, + }, + "defaultTipracks": [ + "opentrons/opentrons_96_tiprack_10ul/1", + "opentrons/opentrons_96_filtertiprack_10ul/1", + "opentrons/geb_96_tiprack_10ul/1", + ], + "displayCategory": "GEN1", + "displayName": "P10 Single-Channel GEN1", + "maxVolume": 10, + "minVolume": 1, + "name": "p10_single", + "smoothieConfigs": { + "homePosition": 220, + "stepsPerMM": 768, + "travelDistance": 30, + }, +} +`; + +exports[`pipette data accessors > getPipetteNameSpecs > name p50_multi snapshot 1`] = ` +{ + "channels": 8, + "defaultAspirateFlowRate": { + "max": 100, + "min": 0.001, + "value": 25, + "valuesByApiLevel": { + "2.0": 25, + }, + }, + "defaultBlowOutFlowRate": { + "max": 1000, + "min": 5, + "value": 1000, + "valuesByApiLevel": { + "2.0": 1000, + }, + }, + "defaultDispenseFlowRate": { + "max": 100, + "min": 0.001, + "value": 50, + "valuesByApiLevel": { + "2.0": 50, + }, + }, + "defaultTipracks": [ + "opentrons/opentrons_96_tiprack_300ul/1", + "opentrons/opentrons_96_filtertiprack_200ul/1", + ], + "displayCategory": "GEN1", + "displayName": "P50 8-Channel GEN1", + "maxVolume": 50, + "minVolume": 5, + "name": "p50_multi", + "smoothieConfigs": { + "homePosition": 220, + "stepsPerMM": 768, + "travelDistance": 30, + }, +} +`; + +exports[`pipette data accessors > getPipetteNameSpecs > name p50_single snapshot 1`] = ` +{ + "channels": 1, + "defaultAspirateFlowRate": { + "max": 100, + "min": 0.001, + "value": 25, + "valuesByApiLevel": { + "2.0": 25, + }, + }, + "defaultBlowOutFlowRate": { + "max": 1000, + "min": 5, + "value": 1000, + "valuesByApiLevel": { + "2.0": 1000, + }, + }, + "defaultDispenseFlowRate": { + "max": 100, + "min": 0.001, + "value": 50, + "valuesByApiLevel": { + "2.0": 50, + }, + }, + "defaultTipracks": [ + "opentrons/opentrons_96_tiprack_300ul/1", + "opentrons/opentrons_96_filtertiprack_200ul/1", + ], + "displayCategory": "GEN1", + "displayName": "P50 Single-Channel GEN1", + "maxVolume": 50, + "minVolume": 5, + "name": "p50_single", + "smoothieConfigs": { + "homePosition": 220, + "stepsPerMM": 768, + "travelDistance": 30, + }, +} +`; + +exports[`pipette data accessors > getPipetteNameSpecs > name p300_multi snapshot 1`] = ` +{ + "channels": 8, + "defaultAspirateFlowRate": { + "max": 600, + "min": 0.001, + "value": 150, + "valuesByApiLevel": { + "2.0": 150, + }, + }, + "defaultBlowOutFlowRate": { + "max": 1000, + "min": 5, + "value": 1000, + "valuesByApiLevel": { + "2.0": 1000, + }, + }, + "defaultDispenseFlowRate": { + "max": 600, + "min": 0.001, + "value": 300, + "valuesByApiLevel": { + "2.0": 300, + }, + }, + "defaultTipracks": [ + "opentrons/opentrons_96_tiprack_300ul/1", + "opentrons/opentrons_96_filtertiprack_200ul/1", + ], + "displayCategory": "GEN1", + "displayName": "P300 8-Channel GEN1", + "maxVolume": 300, + "minVolume": 30, + "name": "p300_multi", + "smoothieConfigs": { + "homePosition": 220, + "stepsPerMM": 768, + "travelDistance": 30, + }, +} +`; + +exports[`pipette data accessors > getPipetteNameSpecs > name p300_single snapshot 1`] = ` +{ + "channels": 1, + "defaultAspirateFlowRate": { + "max": 600, + "min": 0.001, + "value": 150, + "valuesByApiLevel": { + "2.0": 150, + }, + }, + "defaultBlowOutFlowRate": { + "max": 1000, + "min": 5, + "value": 1000, + "valuesByApiLevel": { + "2.0": 1000, + }, + }, + "defaultDispenseFlowRate": { + "max": 600, + "min": 0.001, + "value": 300, + "valuesByApiLevel": { + "2.0": 300, + }, + }, + "defaultTipracks": [ + "opentrons/opentrons_96_tiprack_300ul/1", + "opentrons/opentrons_96_filtertiprack_200ul/1", + ], + "displayCategory": "GEN1", + "displayName": "P300 Single-Channel GEN1", + "maxVolume": 300, + "minVolume": 30, + "name": "p300_single", + "smoothieConfigs": { + "homePosition": 220, + "stepsPerMM": 768, + "travelDistance": 30, + }, +} +`; + +exports[`pipette data accessors > getPipetteNameSpecs > name p1000_single snapshot 1`] = ` +{ + "channels": 1, + "defaultAspirateFlowRate": { + "max": 2000, + "min": 50, + "value": 500, + "valuesByApiLevel": { + "2.0": 500, + }, + }, + "defaultBlowOutFlowRate": { + "max": 1000, + "min": 5, + "value": 1000, + "valuesByApiLevel": { + "2.0": 1000, + }, + }, + "defaultDispenseFlowRate": { + "max": 2000, + "min": 50, + "value": 1000, + "valuesByApiLevel": { + "2.0": 1000, + }, + }, + "defaultTipracks": [ + "opentrons/opentrons_96_tiprack_1000ul/1", + "opentrons/opentrons_96_filtertiprack_1000ul/1", + "opentrons/geb_96_tiprack_1000ul/1", + ], + "displayCategory": "GEN1", + "displayName": "P1000 Single-Channel GEN1", + "maxVolume": 1000, + "minVolume": 100, + "name": "p1000_single", + "smoothieConfigs": { + "homePosition": 220, + "stepsPerMM": 768, + "travelDistance": 30, + }, +} +`; exports[`pipette data accessors getPipetteModelSpecs model p10_multi_v1 snapshot 1`] = ` Object { diff --git a/shared-data/js/__tests__/deckSchemas.test.ts b/shared-data/js/__tests__/deckSchemas.test.ts index 0fa51a27fe7..f59f69a1540 100644 --- a/shared-data/js/__tests__/deckSchemas.test.ts +++ b/shared-data/js/__tests__/deckSchemas.test.ts @@ -3,7 +3,7 @@ import Ajv from 'ajv' import path from 'path' import glob from 'glob' - +import { describe, expect, it } from 'vitest' import deckSchema from '../../deck/schemas/3.json' import deckSchemaV4 from '../../deck/schemas/4.json' diff --git a/shared-data/js/__tests__/errors.test.js b/shared-data/js/__tests__/errors.test.js index a70bc02f3bb..68495d7dc9c 100644 --- a/shared-data/js/__tests__/errors.test.js +++ b/shared-data/js/__tests__/errors.test.js @@ -1,8 +1,8 @@ // tests for error accessors - +import { describe, expect, it } from 'vitest' import { getError } from '../errors' -import errorDefinitions from '@opentrons/shared-data/errors/definitions/1/errors.json' +import errorDefinitions from '../../errors/definitions/1/errors.json' Object.keys(errorDefinitions.codes).forEach(errorCode => describe(`error ${errorCode} accessors`, () => { diff --git a/shared-data/js/__tests__/getAreSlotsAdjacent.test.ts b/shared-data/js/__tests__/getAreSlotsAdjacent.test.ts index 30dddf5e3bc..33067cb95e8 100644 --- a/shared-data/js/__tests__/getAreSlotsAdjacent.test.ts +++ b/shared-data/js/__tests__/getAreSlotsAdjacent.test.ts @@ -1,3 +1,4 @@ +import { describe, expect, it } from 'vitest' import { getAreSlotsAdjacent, getAreSlotsHorizontallyAdjacent, diff --git a/shared-data/js/__tests__/getWellNamePerMultiTip.test.ts b/shared-data/js/__tests__/getWellNamePerMultiTip.test.ts index b7dde18bf55..4d8c792187b 100644 --- a/shared-data/js/__tests__/getWellNamePerMultiTip.test.ts +++ b/shared-data/js/__tests__/getWellNamePerMultiTip.test.ts @@ -1,3 +1,4 @@ +import { describe, expect, it } from 'vitest' import fixture_trash from '../../labware/fixtures/2/fixture_trash.json' import fixture_96_plate from '../../labware/fixtures/2/fixture_96_plate.json' import fixture_384_plate from '../../labware/fixtures/2/fixture_384_plate.json' diff --git a/shared-data/js/__tests__/labwareDefQuirks.test.ts b/shared-data/js/__tests__/labwareDefQuirks.test.ts index 6b8eedaddf9..6ebc39f9f17 100644 --- a/shared-data/js/__tests__/labwareDefQuirks.test.ts +++ b/shared-data/js/__tests__/labwareDefQuirks.test.ts @@ -1,5 +1,6 @@ import path from 'path' import glob from 'glob' +import { describe, expect, it, beforeAll } from 'vitest' const definitionsGlobPath = path.join( __dirname, diff --git a/shared-data/js/__tests__/labwareDefSchemaV1.test.ts b/shared-data/js/__tests__/labwareDefSchemaV1.test.ts index 6247e05f06a..3a14648eed3 100644 --- a/shared-data/js/__tests__/labwareDefSchemaV1.test.ts +++ b/shared-data/js/__tests__/labwareDefSchemaV1.test.ts @@ -1,6 +1,7 @@ import path from 'path' import glob from 'glob' import Ajv from 'ajv' +import { describe, expect, it, beforeAll } from 'vitest' import { labwareSchemaV1 } from '../schema' import type { LabwareDefinition1 } from '../types' diff --git a/shared-data/js/__tests__/labwareDefSchemaV2.test.ts b/shared-data/js/__tests__/labwareDefSchemaV2.test.ts index 37d6a9118e0..f95e663eabd 100644 --- a/shared-data/js/__tests__/labwareDefSchemaV2.test.ts +++ b/shared-data/js/__tests__/labwareDefSchemaV2.test.ts @@ -2,6 +2,7 @@ import path from 'path' import glob from 'glob' import Ajv from 'ajv' +import { describe, expect, it, beforeAll, test } from 'vitest' import schema from '../../labware/schemas/2.json' import type { LabwareDefinition2, LabwareWell } from '../types' diff --git a/shared-data/js/__tests__/moduleAccessors.test.ts b/shared-data/js/__tests__/moduleAccessors.test.ts index ccc7ceaf46a..d090547f01e 100644 --- a/shared-data/js/__tests__/moduleAccessors.test.ts +++ b/shared-data/js/__tests__/moduleAccessors.test.ts @@ -1,3 +1,5 @@ +import { describe, expect, it } from 'vitest' + import { getModuleDef2, getModuleType, @@ -36,15 +38,16 @@ describe('all valid models work', () => { }) }) -describe('legacy models work too', () => { +describe('legacy models', () => { const legacyEquivs = [ [TEMPDECK, TEMPERATURE_MODULE_V1], [MAGDECK, MAGNETIC_MODULE_V1], [THERMOCYCLER, THERMOCYCLER_MODULE_V1], ] as const - - legacyEquivs.forEach(([legacy, modern]) => { - const fromLegacy = normalizeModuleModel(legacy) - expect(fromLegacy).toEqual(modern) + it('legacy models work too', () => { + legacyEquivs.forEach(([legacy, modern]) => { + const fromLegacy = normalizeModuleModel(legacy) + expect(fromLegacy).toEqual(modern) + }) }) }) diff --git a/shared-data/js/__tests__/moduleSpecsSchema.test.ts b/shared-data/js/__tests__/moduleSpecsSchema.test.ts index 26bb0388d07..b19d1099b12 100644 --- a/shared-data/js/__tests__/moduleSpecsSchema.test.ts +++ b/shared-data/js/__tests__/moduleSpecsSchema.test.ts @@ -1,4 +1,5 @@ import Ajv from 'ajv' +import { describe, expect, it, beforeAll } from 'vitest' import moduleSpecsSchemaV1 from '../../module/schemas/1.json' import moduleSpecsV1 from '../../module/definitions/1.json' import moduleSpecsSchemaV2 from '../../module/schemas/2.json' diff --git a/shared-data/js/__tests__/pipetteSchemaV2.test.ts b/shared-data/js/__tests__/pipetteSchemaV2.test.ts index 1dce5ef754b..d5007cd276c 100644 --- a/shared-data/js/__tests__/pipetteSchemaV2.test.ts +++ b/shared-data/js/__tests__/pipetteSchemaV2.test.ts @@ -1,6 +1,7 @@ import Ajv from 'ajv' import glob from 'glob' import path from 'path' +import { describe, expect, it } from 'vitest' import liquidSpecsSchema from '../../pipette/schemas/2/pipetteLiquidPropertiesSchema.json' import geometrySpecsSchema from '../../pipette/schemas/2/pipetteGeometrySchema.json' diff --git a/shared-data/js/__tests__/pipetteSpecSchemas.test.ts b/shared-data/js/__tests__/pipetteSpecSchemas.test.ts index 9368088c7ab..12975a646fc 100644 --- a/shared-data/js/__tests__/pipetteSpecSchemas.test.ts +++ b/shared-data/js/__tests__/pipetteSpecSchemas.test.ts @@ -1,4 +1,6 @@ import Ajv from 'ajv' +import { describe, expect, it } from 'vitest' + import nameSpecsSchema from '../../pipette/schemas/1/pipetteNameSpecsSchema.json' import modelSpecsSchema from '../../pipette/schemas/1/pipetteModelSpecsSchema.json' import pipetteNameSpecs from '../../pipette/definitions/1/pipetteNameSpecs.json' diff --git a/shared-data/js/__tests__/pipettes.test.ts b/shared-data/js/__tests__/pipettes.test.ts index 9cf9d42fe02..c5f3e4ddd4b 100644 --- a/shared-data/js/__tests__/pipettes.test.ts +++ b/shared-data/js/__tests__/pipettes.test.ts @@ -1,4 +1,5 @@ // tests for pipette info accessors in `shared-data/js/pipettes.js` +import { describe, expect, it } from 'vitest' import { getPipetteNameSpecs, getPipetteModelSpecs } from '../pipettes' const PIPETTE_NAMES = [ diff --git a/shared-data/js/__tests__/protocolSchemaV4.test.ts b/shared-data/js/__tests__/protocolSchemaV4.test.ts index 6bece89c30a..ff3da635b3a 100644 --- a/shared-data/js/__tests__/protocolSchemaV4.test.ts +++ b/shared-data/js/__tests__/protocolSchemaV4.test.ts @@ -4,6 +4,7 @@ import Ajv from 'ajv' import path from 'path' import glob from 'glob' import omit from 'lodash/omit' +import { describe, expect, it } from 'vitest' import protocolSchema from '../../protocol/schemas/4.json' import labwareV2Schema from '../../labware/schemas/2.json' diff --git a/shared-data/js/__tests__/protocolSchemaV5.test.ts b/shared-data/js/__tests__/protocolSchemaV5.test.ts index 8188e7ce7f9..c329aebc072 100644 --- a/shared-data/js/__tests__/protocolSchemaV5.test.ts +++ b/shared-data/js/__tests__/protocolSchemaV5.test.ts @@ -4,6 +4,7 @@ import Ajv from 'ajv' import path from 'path' import glob from 'glob' import omit from 'lodash/omit' +import { describe, expect, it } from 'vitest' import protocolSchema from '../../protocol/schemas/5.json' import labwareV2Schema from '../../labware/schemas/2.json' diff --git a/shared-data/js/__tests__/protocolSchemaV6.test.ts b/shared-data/js/__tests__/protocolSchemaV6.test.ts index a457070be29..dfc42ae1a11 100644 --- a/shared-data/js/__tests__/protocolSchemaV6.test.ts +++ b/shared-data/js/__tests__/protocolSchemaV6.test.ts @@ -4,6 +4,7 @@ import Ajv from 'ajv' import path from 'path' import glob from 'glob' import omit from 'lodash/omit' +import { describe, expect, it } from 'vitest' import protocolSchema from '../../protocol/schemas/6.json' import labwareV2Schema from '../../labware/schemas/2.json' diff --git a/shared-data/js/__tests__/protocolSchemaV7.test.ts b/shared-data/js/__tests__/protocolSchemaV7.test.ts index f787e0c1ebf..cb67b353ca1 100644 --- a/shared-data/js/__tests__/protocolSchemaV7.test.ts +++ b/shared-data/js/__tests__/protocolSchemaV7.test.ts @@ -4,6 +4,7 @@ import Ajv from 'ajv' import path from 'path' import glob from 'glob' import omit from 'lodash/omit' +import { describe, expect, it } from 'vitest' import protocolSchema from '../../protocol/schemas/7.json' import labwareV2Schema from '../../labware/schemas/2.json' diff --git a/shared-data/js/__tests__/protocolValidation.test.ts b/shared-data/js/__tests__/protocolValidation.test.ts index ef5ff808a4c..77dab685102 100644 --- a/shared-data/js/__tests__/protocolValidation.test.ts +++ b/shared-data/js/__tests__/protocolValidation.test.ts @@ -4,6 +4,7 @@ import path from 'path' import glob from 'glob' import { validate } from '../protocols' import { omit } from 'lodash' +import { describe, expect, it } from 'vitest' const relRoot = path.join(__dirname, '../../protocol/fixtures/') diff --git a/shared-data/js/__tests__/sortWells.test.ts b/shared-data/js/__tests__/sortWells.test.ts index ac2501b25c6..9774320df97 100644 --- a/shared-data/js/__tests__/sortWells.test.ts +++ b/shared-data/js/__tests__/sortWells.test.ts @@ -1,3 +1,4 @@ +import { describe, expect, it } from 'vitest' import { sortWells } from '../helpers' describe('sortWells', () => { diff --git a/shared-data/js/__tests__/splitWellsOnColumn.test.ts b/shared-data/js/__tests__/splitWellsOnColumn.test.ts index 77229116829..61683281292 100644 --- a/shared-data/js/__tests__/splitWellsOnColumn.test.ts +++ b/shared-data/js/__tests__/splitWellsOnColumn.test.ts @@ -1,3 +1,4 @@ +import { describe, expect, it } from 'vitest' import { splitWellsOnColumn } from '../helpers' describe('test splitWellsOnColumn', () => { diff --git a/shared-data/js/__tests__/validateErrors.test.js b/shared-data/js/__tests__/validateErrors.test.js index 80de54debcc..742d3920452 100644 --- a/shared-data/js/__tests__/validateErrors.test.js +++ b/shared-data/js/__tests__/validateErrors.test.js @@ -1,9 +1,10 @@ // Tests for error data validation +import { describe, expect, it } from 'vitest' import Ajv from 'ajv' -import errorDefinitions from '@opentrons/shared-data/errors/definitions/1/errors.json' -import errorSchema from '@opentrons/shared-data/errors/schemas/1.json' +import errorDefinitions from '../../errors/definitions/1/errors.json' +import errorSchema from '../../errors/schemas/1.json' describe('error data should match error schema', () => { it('error schema should match', () => { diff --git a/shared-data/js/helpers/__tests__/getAdapterName.test.ts b/shared-data/js/helpers/__tests__/getAdapterName.test.ts index f53973a04f9..6feff3637ce 100644 --- a/shared-data/js/helpers/__tests__/getAdapterName.test.ts +++ b/shared-data/js/helpers/__tests__/getAdapterName.test.ts @@ -1,3 +1,4 @@ +import { describe, it, expect } from 'vitest' import { getAdapterName } from '../index' describe('getAdapterName', () => { diff --git a/shared-data/js/helpers/__tests__/getDeckDefFromLoadedLabware.test.ts b/shared-data/js/helpers/__tests__/getDeckDefFromLoadedLabware.test.ts index 840753899ce..9c7a1318e06 100644 --- a/shared-data/js/helpers/__tests__/getDeckDefFromLoadedLabware.test.ts +++ b/shared-data/js/helpers/__tests__/getDeckDefFromLoadedLabware.test.ts @@ -1,3 +1,4 @@ +import { describe, it, expect } from 'vitest' import ot2DeckDef from '../../../deck/definitions/4/ot2_standard.json' import ot3DeckDef from '../../../deck/definitions/4/ot3_standard.json' import { getDeckDefFromRobotType } from '..' diff --git a/shared-data/js/helpers/__tests__/getSimplestFlexDeckConfig.test.ts b/shared-data/js/helpers/__tests__/getSimplestFlexDeckConfig.test.ts index 293433b0457..58b655c14e0 100644 --- a/shared-data/js/helpers/__tests__/getSimplestFlexDeckConfig.test.ts +++ b/shared-data/js/helpers/__tests__/getSimplestFlexDeckConfig.test.ts @@ -1,3 +1,4 @@ +import { describe, it, expect } from 'vitest' import { FLEX_SIMPLEST_DECK_CONFIG_PROTOCOL_SPEC, getSimplestDeckConfigForProtocol, diff --git a/shared-data/js/helpers/__tests__/getVectorDifference.test.ts b/shared-data/js/helpers/__tests__/getVectorDifference.test.ts index 23bc4d873af..e57113a1297 100644 --- a/shared-data/js/helpers/__tests__/getVectorDifference.test.ts +++ b/shared-data/js/helpers/__tests__/getVectorDifference.test.ts @@ -1,3 +1,4 @@ +import { describe, it, expect } from 'vitest' import { getVectorDifference } from '../getVectorDifference' describe('getVectorDifference', () => { diff --git a/shared-data/js/helpers/__tests__/getVectorSum.test.ts b/shared-data/js/helpers/__tests__/getVectorSum.test.ts index 4362ac5ce98..91c656767f7 100644 --- a/shared-data/js/helpers/__tests__/getVectorSum.test.ts +++ b/shared-data/js/helpers/__tests__/getVectorSum.test.ts @@ -1,3 +1,4 @@ +import { describe, it, expect } from 'vitest' import { getVectorSum } from '../getVectorSum' describe('getVectorSum', () => { diff --git a/shared-data/js/helpers/__tests__/labwareInference.test.ts b/shared-data/js/helpers/__tests__/labwareInference.test.ts index 8c30693d34f..e0c5af32f11 100644 --- a/shared-data/js/helpers/__tests__/labwareInference.test.ts +++ b/shared-data/js/helpers/__tests__/labwareInference.test.ts @@ -1,3 +1,4 @@ +import { describe, it, expect } from 'vitest' import { getIfConsistent, getSpacingIfUniform } from '../labwareInference' describe('getSpacingIfUniform', () => { diff --git a/shared-data/js/helpers/__tests__/orderWells.test.ts b/shared-data/js/helpers/__tests__/orderWells.test.ts index 462f487e7a7..0190c3a03fc 100644 --- a/shared-data/js/helpers/__tests__/orderWells.test.ts +++ b/shared-data/js/helpers/__tests__/orderWells.test.ts @@ -1,3 +1,4 @@ +import { describe, it, expect } from 'vitest' import { orderWells } from '../orderWells' import type { WellOrderOption } from '../orderWells' diff --git a/shared-data/js/helpers/__tests__/parseProtocolData.test.ts b/shared-data/js/helpers/__tests__/parseProtocolData.test.ts index abac736ea15..fa1850188f9 100644 --- a/shared-data/js/helpers/__tests__/parseProtocolData.test.ts +++ b/shared-data/js/helpers/__tests__/parseProtocolData.test.ts @@ -49,7 +49,7 @@ describe('validateJsonProtocolFileContents', () => { it('should call handleError with INVALID_FILE_TYPE if empty json', () => { validateJsonProtocolFileContents('[]', handleError) expect(handleError).toBeCalledWith('INVALID_JSON_FILE', { - rawError: expect.any(Error), + rawError: 'Error: schema should be object or boolean', }) }) @@ -70,7 +70,7 @@ describe('validateJsonProtocolFileContents', () => { }) validateJsonProtocolFileContents('[]', handleError) expect(handleError).toBeCalledWith('INVALID_JSON_FILE', { - rawError: expect.any(Error), + rawError: 'Error: not parseable as JSON', }) parseSpy.mockRestore() }) diff --git a/shared-data/js/helpers/__tests__/volume.test.ts b/shared-data/js/helpers/__tests__/volume.test.ts index fef3e2e8750..de5fed5cb76 100644 --- a/shared-data/js/helpers/__tests__/volume.test.ts +++ b/shared-data/js/helpers/__tests__/volume.test.ts @@ -1,4 +1,5 @@ // volume helpers tests +import { describe, it, expect } from 'vitest' import * as helpers from '..' interface BaseSpec any> { diff --git a/shared-data/js/helpers/__tests__/wellSets.test.ts b/shared-data/js/helpers/__tests__/wellSets.test.ts index a0be4f4edde..7fa5a729335 100644 --- a/shared-data/js/helpers/__tests__/wellSets.test.ts +++ b/shared-data/js/helpers/__tests__/wellSets.test.ts @@ -1,3 +1,4 @@ +import { describe, it, expect, beforeEach } from 'vitest' import pipetteNameSpecsFixtures from '../../../pipette/fixtures/name/pipetteNameSpecFixtures.json' import fixture_12_trough from '../../../labware/fixtures/2/fixture_12_trough.json' import fixture_96_plate from '../../../labware/fixtures/2/fixture_96_plate.json' diff --git a/shared-data/js/labwareTools/__tests__/__snapshots__/createIrregularLabware.test.ts.snap b/shared-data/js/labwareTools/__tests__/__snapshots__/createIrregularLabware.test.ts.snap index 99a8acd70e8..96ac3e3853b 100644 --- a/shared-data/js/labwareTools/__tests__/__snapshots__/createIrregularLabware.test.ts.snap +++ b/shared-data/js/labwareTools/__tests__/__snapshots__/createIrregularLabware.test.ts.snap @@ -1,3 +1,5 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`test createIrregularLabware function > failing to validate against labware schema throws w/o "strict" 1`] = `[Error: Generated labware failed to validate, please check your inputs]`; exports[`test createIrregularLabware function failing to validate against labware schema throws w/o "strict" 1`] = `"Generated labware failed to validate, please check your inputs"`; diff --git a/shared-data/js/labwareTools/__tests__/__snapshots__/createLabware.test.ts.snap b/shared-data/js/labwareTools/__tests__/__snapshots__/createLabware.test.ts.snap index 4022be49725..122b6a3894e 100644 --- a/shared-data/js/labwareTools/__tests__/__snapshots__/createLabware.test.ts.snap +++ b/shared-data/js/labwareTools/__tests__/__snapshots__/createLabware.test.ts.snap @@ -1,3 +1,5 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`createLabware > failing to validate against labware schema throws w/o "strict" 1`] = `[Error: Generated labware failed to validate, please check your inputs]`; exports[`createLabware failing to validate against labware schema throws w/o "strict" 1`] = `"Generated labware failed to validate, please check your inputs"`; diff --git a/shared-data/js/labwareTools/__tests__/createDefaultDisplayName.test.ts b/shared-data/js/labwareTools/__tests__/createDefaultDisplayName.test.ts index 5ec5b62d272..01eef82a83c 100644 --- a/shared-data/js/labwareTools/__tests__/createDefaultDisplayName.test.ts +++ b/shared-data/js/labwareTools/__tests__/createDefaultDisplayName.test.ts @@ -1,3 +1,4 @@ +import { describe, it, expect } from 'vitest' import { createDefaultDisplayName } from '..' import type { RegularNameProps } from '..' diff --git a/shared-data/js/labwareTools/__tests__/createIrregularLabware.test.ts b/shared-data/js/labwareTools/__tests__/createIrregularLabware.test.ts index f0fefe7339c..20545efcc53 100644 --- a/shared-data/js/labwareTools/__tests__/createIrregularLabware.test.ts +++ b/shared-data/js/labwareTools/__tests__/createIrregularLabware.test.ts @@ -1,6 +1,6 @@ import omit from 'lodash/omit' import range from 'lodash/range' - +import { describe, it, expect, beforeEach } from 'vitest' import { splitWellsOnColumn, sortWells } from '../../helpers/index' import fixture_irregular_example_1 from '../../../labware/fixtures/2/fixture_irregular_example_1.json' diff --git a/shared-data/js/labwareTools/__tests__/createLabware.test.ts b/shared-data/js/labwareTools/__tests__/createLabware.test.ts index 549c4783dee..a55ed9531e1 100644 --- a/shared-data/js/labwareTools/__tests__/createLabware.test.ts +++ b/shared-data/js/labwareTools/__tests__/createLabware.test.ts @@ -1,5 +1,6 @@ import omit from 'lodash/omit' import range from 'lodash/range' +import { describe, it, expect, beforeEach } from 'vitest' import { createRegularLabware } from '..' import fixture_regular_example_1 from '../../../labware/fixtures/2/fixture_regular_example_1.json' import fixture_regular_example_2 from '../../../labware/fixtures/2/fixture_regular_example_2.json' diff --git a/shared-data/labware/fixtures/2/fixture_calibration_block.json b/shared-data/labware/fixtures/2/fixture_calibration_block.json index 6cf6e2b4744..9939448b144 100644 --- a/shared-data/labware/fixtures/2/fixture_calibration_block.json +++ b/shared-data/labware/fixtures/2/fixture_calibration_block.json @@ -57,10 +57,10 @@ "format": "irregular", "isTiprack": false, "isMagneticModuleCompatible": false, - "loadName": "opentrons_calibrationblock_short_side_left" + "loadName": "fixture_calibration_block" }, "ordering": [["A1"], ["A2"]], - "namespace": "opentrons", + "namespace": "fixture", "version": 1, "schemaVersion": 2, "cornerOffsetFromSlot": { From 8fb9f62c41335975177b423b5c86477a59bcd301 Mon Sep 17 00:00:00 2001 From: koji Date: Fri, 1 Mar 2024 16:31:38 -0500 Subject: [PATCH 5/5] fix app test errors --- .../labware/__tests__/findLabware.test.ts | 35 ++++++++++-------- .../useOffsetCandidatesForAnalysis.test.tsx | 2 +- .../__tests__/getFinalLabwareLocation.test.ts | 3 +- ...kConfigurationDiscardChangesModal.test.tsx | 9 +++-- .../ProtocolRunModuleControls.test.tsx | 18 +++++----- .../SetupPipetteCalibrationItem.test.tsx | 36 ++++++++++--------- .../__tests__/getLabwareRenderInfo.test.ts | 9 ++--- .../__tests__/getLocationInfoNames.test.ts | 8 ++--- .../getSlotLabwareDefinition.test.ts | 1 + 9 files changed, 67 insertions(+), 54 deletions(-) diff --git a/app/src/assets/labware/__tests__/findLabware.test.ts b/app/src/assets/labware/__tests__/findLabware.test.ts index acd2b78986c..c5a6675fa90 100644 --- a/app/src/assets/labware/__tests__/findLabware.test.ts +++ b/app/src/assets/labware/__tests__/findLabware.test.ts @@ -1,37 +1,44 @@ +import { describe, it, vi, afterEach, expect } from 'vitest' + +import { fixtureTiprack10ul, fixtureTiprack300ul } from '@opentrons/shared-data' + import { getLatestLabwareDef } from '../getLabware' import { findLabwareDefWithCustom } from '../findLabware' + import type { LabwareDefinition2 } from '@opentrons/shared-data' -import fixture_tiprack_10_ul from '@opentrons/shared-data/labware/fixtures/2/fixture_tiprack_10_ul.json' -import fixture_tiprack_300_ul from '@opentrons/shared-data/labware/fixtures/2/fixture_tiprack_300_ul.json' -jest.mock('../getLabware', () => ({ - getLatestLabwareDef: jest.fn(), -})) +vi.mock('../getLabware', async importOriginal => { + const actual = await importOriginal() + return { + ...actual, + getLatestLabwareDef: vi.fn(), + } +}) const mockGetLabware = getLatestLabwareDef as jest.MockedFunction< typeof getLatestLabwareDef > -const fixtureTipRack10ul = fixture_tiprack_10_ul as LabwareDefinition2 +const fixtureTipRack10ul = fixtureTiprack10ul as LabwareDefinition2 const fixtureTipRack10ulCustomBeta = { - ...fixture_tiprack_10_ul, + ...fixtureTiprack10ul, namespace: 'custom_beta', } as LabwareDefinition2 const fixtureTipRack10ulVersion2 = { - ...fixture_tiprack_10_ul, + ...fixtureTiprack10ul, version: 2, } as LabwareDefinition2 const fixtureTipRack300ulOpentrons = { - ...fixture_tiprack_300_ul, + ...fixtureTiprack300ul, namespace: 'opentrons', } as LabwareDefinition2 describe('findLabwareDefWithCustom', () => { afterEach(() => { - jest.resetAllMocks() + vi.resetAllMocks() }) it('finds standard labware with namesearch', () => { @@ -63,7 +70,7 @@ describe('findLabwareDefWithCustom', () => { const SPECS = [ { should: 'find nothing with no specs', - customLabware: [fixture_tiprack_10_ul, fixture_tiprack_300_ul], + customLabware: [fixtureTiprack10ul, fixtureTiprack300ul], expect: null, namespace: null, loadName: null, @@ -71,8 +78,8 @@ describe('findLabwareDefWithCustom', () => { }, { should: 'find the first item with only namespace', - customLabware: [fixture_tiprack_10_ul, fixture_tiprack_300_ul], - expect: fixture_tiprack_10_ul, + customLabware: [fixtureTiprack10ul, fixtureTiprack300ul], + expect: fixtureTiprack10ul, namespace: 'fixture', loadName: null, version: null, @@ -92,7 +99,7 @@ describe('findLabwareDefWithCustom', () => { { should: 'find the right item with loadName and namespace', customLabware: [ - fixture_tiprack_10_ul, + fixtureTiprack10ul, fixtureTipRack10ulCustomBeta, fixtureTipRack10ulVersion2, ], diff --git a/app/src/organisms/ApplyHistoricOffsets/hooks/__tests__/useOffsetCandidatesForAnalysis.test.tsx b/app/src/organisms/ApplyHistoricOffsets/hooks/__tests__/useOffsetCandidatesForAnalysis.test.tsx index cfc3a2f459b..b442cef4b41 100644 --- a/app/src/organisms/ApplyHistoricOffsets/hooks/__tests__/useOffsetCandidatesForAnalysis.test.tsx +++ b/app/src/organisms/ApplyHistoricOffsets/hooks/__tests__/useOffsetCandidatesForAnalysis.test.tsx @@ -1,5 +1,5 @@ import * as React from 'react' -import { describe, it, expect, vi } from 'vitest' +import { describe, it, expect, vi, beforeEach } from 'vitest' import { when } from 'vitest-when' import { renderHook, waitFor } from '@testing-library/react' import { diff --git a/app/src/organisms/CommandText/utils/__tests__/getFinalLabwareLocation.test.ts b/app/src/organisms/CommandText/utils/__tests__/getFinalLabwareLocation.test.ts index b592c14263a..a72321fbe9f 100644 --- a/app/src/organisms/CommandText/utils/__tests__/getFinalLabwareLocation.test.ts +++ b/app/src/organisms/CommandText/utils/__tests__/getFinalLabwareLocation.test.ts @@ -1,4 +1,5 @@ -import fixture_tiprack_10_ul from '@opentrons/shared-data/labware/fixtures/2/fixture_tiprack_10_ul.json' +import { describe, it, expect } from 'vitest' +import { fixture_tiprack_10_ul } from '@opentrons/shared-data' import { getFinalLabwareLocation } from '../getFinalLabwareLocation' import type { LabwareDefinition2 } from '@opentrons/shared-data' diff --git a/app/src/organisms/DeviceDetailsDeckConfiguration/__tests__/DeckConfigurationDiscardChangesModal.test.tsx b/app/src/organisms/DeviceDetailsDeckConfiguration/__tests__/DeckConfigurationDiscardChangesModal.test.tsx index 058123a4526..b51e17ce500 100644 --- a/app/src/organisms/DeviceDetailsDeckConfiguration/__tests__/DeckConfigurationDiscardChangesModal.test.tsx +++ b/app/src/organisms/DeviceDetailsDeckConfiguration/__tests__/DeckConfigurationDiscardChangesModal.test.tsx @@ -6,14 +6,17 @@ import { renderWithProviders } from '../../../__testing-utils__' import { i18n } from '../../../i18n' import { DeckConfigurationDiscardChangesModal } from '../DeckConfigurationDiscardChangesModal' +import type * as ReactRouterDom from 'react-router-dom' + const mockFunc = vi.fn() const mockGoBack = vi.fn() +const mockPush = vi.fn() -vi.mock('react-router-dom', () => { - const reactRouterDom = vi.requireActual('react-router-dom') +vi.mock('react-router-dom', async importOriginal => { + const reactRouterDom = await importOriginal() return { ...reactRouterDom, - useHistory: () => ({ goBack: mockGoBack } as any), + useHistory: () => ({ push: mockPush } as any), } }) diff --git a/app/src/organisms/Devices/ProtocolRun/__tests__/ProtocolRunModuleControls.test.tsx b/app/src/organisms/Devices/ProtocolRun/__tests__/ProtocolRunModuleControls.test.tsx index dd6e3b18209..c17140d8a3a 100644 --- a/app/src/organisms/Devices/ProtocolRun/__tests__/ProtocolRunModuleControls.test.tsx +++ b/app/src/organisms/Devices/ProtocolRun/__tests__/ProtocolRunModuleControls.test.tsx @@ -1,6 +1,6 @@ import * as React from 'react' import { when } from 'vitest-when' -import { describe, it, beforeEach, vi, afterEach, expect } from 'vitest' +import { describe, it, beforeEach, vi, afterEach } from 'vitest' import { screen } from '@testing-library/react' import { renderWithProviders } from '../../../../__testing-utils__' @@ -59,11 +59,9 @@ const render = ( describe('ProtocolRunModuleControls', () => { beforeEach(() => { - when(vi.mocked(useInstrumentsQuery)) - .calledWith() - .thenReturn({ - data: { data: [] }, - } as any) + vi.mocked(useInstrumentsQuery).mockReturnValue({ + data: { data: [] }, + } as any) }) afterEach(() => { @@ -86,7 +84,7 @@ describe('ProtocolRunModuleControls', () => { attachedModuleMatch: mockMagneticModuleGen2, }, } as any) - when(vi.mocked(ModuleCard)).thenReturn(
mock Magnetic Module Card
) + vi.mocked(ModuleCard).mockReturnValue(
mock Magnetic Module Card
) render({ robotName: 'otie', runId: 'test123', @@ -111,7 +109,7 @@ describe('ProtocolRunModuleControls', () => { attachedModuleMatch: mockTemperatureModuleGen2, }, } as any) - when(vi.mocked(ModuleCard)).thenReturn( + vi.mocked(ModuleCard).mockReturnValue(
mock Temperature Module Card
) render({ @@ -139,7 +137,7 @@ describe('ProtocolRunModuleControls', () => { }, } as any) - when(vi.mocked(ModuleCard)).thenReturn( + vi.mocked(ModuleCard).mockReturnValue(
mock Thermocycler Module Card
) @@ -167,7 +165,7 @@ describe('ProtocolRunModuleControls', () => { attachedModuleMatch: mockHeaterShaker, }, } as any) - when(vi.mocked(ModuleCard)).thenReturn( + vi.mocked(ModuleCard).mockReturnValue(
mock Heater-Shaker Module Card
) diff --git a/app/src/organisms/Devices/ProtocolRun/__tests__/SetupPipetteCalibrationItem.test.tsx b/app/src/organisms/Devices/ProtocolRun/__tests__/SetupPipetteCalibrationItem.test.tsx index 482235a1a86..30fed2b3abb 100644 --- a/app/src/organisms/Devices/ProtocolRun/__tests__/SetupPipetteCalibrationItem.test.tsx +++ b/app/src/organisms/Devices/ProtocolRun/__tests__/SetupPipetteCalibrationItem.test.tsx @@ -1,7 +1,9 @@ import * as React from 'react' -import { when, resetAllWhenMocks } from 'jest-when' +import { when } from 'vitest-when' +import { describe, it, beforeEach, vi, afterEach, expect } from 'vitest' +import { screen } from '@testing-library/react' -import { renderWithProviders } from '../../../../__testing-utils__'} +import { renderWithProviders } from '../../../../__testing-utils__' import { i18n } from '../../../../i18n' import { mockDeckCalData } from '../../../../redux/calibration/__fixtures__' import { mockPipetteInfo } from '../../../../redux/pipettes/__fixtures__' @@ -9,7 +11,7 @@ import { useDeckCalibrationData } from '../../hooks' import { SetupPipetteCalibrationItem } from '../SetupPipetteCalibrationItem' import { MemoryRouter } from 'react-router-dom' -jest.mock('../../hooks') +vi.mock('../../hooks') const mockUseDeckCalibrationData = useDeckCalibrationData as jest.MockedFunction< typeof useDeckCalibrationData @@ -42,23 +44,23 @@ describe('SetupPipetteCalibrationItem', () => { } beforeEach(() => { - when(mockUseDeckCalibrationData).calledWith(ROBOT_NAME).mockReturnValue({ + when(mockUseDeckCalibrationData).calledWith(ROBOT_NAME).thenReturn({ deckCalibrationData: mockDeckCalData, isDeckCalibrated: true, }) }) afterEach(() => { - resetAllWhenMocks() + vi.clearAllMocks() }) it('renders the mount and pipette name', () => { - const { getByText } = render() - getByText('Left Mount') - getByText(mockPipetteInfo.pipetteSpecs.displayName) + render() + screen.getByText('Left Mount') + screen.getByText(mockPipetteInfo.pipetteSpecs.displayName) }) it('renders a link to the calibration dashboard if pipette attached but not calibrated', () => { - const { getByText, getByRole } = render({ + render({ pipetteInfo: { ...mockPipetteInfo, tipRacksForPipette: [], @@ -67,15 +69,17 @@ describe('SetupPipetteCalibrationItem', () => { }, }) - getByText('Not calibrated yet') + screen.getByText('Not calibrated yet') expect( - getByRole('link', { - name: 'Calibrate now', - }).getAttribute('href') + screen + .getByRole('link', { + name: 'Calibrate now', + }) + .getAttribute('href') ).toBe('/devices/otie/robot-settings/calibration/dashboard') }) it('renders the pipette mismatch info if pipette calibrated but an inexact match', () => { - const { getByText, getByRole } = render({ + render({ pipetteInfo: { ...mockPipetteInfo, tipRacksForPipette: [], @@ -83,7 +87,7 @@ describe('SetupPipetteCalibrationItem', () => { pipetteCalDate: 'september 3, 2020', }, }) - getByRole('link', { name: 'Learn more' }) - getByText('Pipette generation mismatch.') + screen.getByRole('link', { name: 'Learn more' }) + screen.getByText('Pipette generation mismatch.') }) }) diff --git a/app/src/organisms/Devices/ProtocolRun/utils/__tests__/getLabwareRenderInfo.test.ts b/app/src/organisms/Devices/ProtocolRun/utils/__tests__/getLabwareRenderInfo.test.ts index 359e4faad3f..f96bacc93b6 100644 --- a/app/src/organisms/Devices/ProtocolRun/utils/__tests__/getLabwareRenderInfo.test.ts +++ b/app/src/organisms/Devices/ProtocolRun/utils/__tests__/getLabwareRenderInfo.test.ts @@ -1,13 +1,14 @@ -import _protocolWithMagTempTC from '@opentrons/shared-data/protocol/fixtures/6/transferSettings.json' -import _standardDeckDef from '@opentrons/shared-data/deck/definitions/4/ot2_standard.json' +import { describe, it, expect } from 'vitest' + +import { transfer_settings, ot2DeckDefV4 } from '@opentrons/shared-data' import { getLabwareRenderInfo } from '../getLabwareRenderInfo' import type { CompletedProtocolAnalysis, LoadLabwareRunTimeCommand, } from '@opentrons/shared-data' -const protocolWithMagTempTC = (_protocolWithMagTempTC as unknown) as CompletedProtocolAnalysis -const standardDeckDef = _standardDeckDef as any +const protocolWithMagTempTC = (transfer_settings as unknown) as CompletedProtocolAnalysis +const standardDeckDef = ot2DeckDefV4 as any describe('getLabwareRenderInfo', () => { it('should gather labware coordinates', () => { diff --git a/app/src/organisms/Devices/ProtocolRun/utils/__tests__/getLocationInfoNames.test.ts b/app/src/organisms/Devices/ProtocolRun/utils/__tests__/getLocationInfoNames.test.ts index 1a83edf9bd1..8ff543ffcf4 100644 --- a/app/src/organisms/Devices/ProtocolRun/utils/__tests__/getLocationInfoNames.test.ts +++ b/app/src/organisms/Devices/ProtocolRun/utils/__tests__/getLocationInfoNames.test.ts @@ -1,3 +1,4 @@ +import { describe, it, vi, expect, beforeEach } from 'vitest' import { getLabwareDisplayName, ModuleModel } from '@opentrons/shared-data' import { getLocationInfoNames } from '../getLocationInfoNames' @@ -118,14 +119,11 @@ const MOCK_ADAPTER_COMMANDS = [ }, ] -jest.mock('@opentrons/shared-data') -const mockGetLabwareDisplayName = getLabwareDisplayName as jest.MockedFunction< - typeof getLabwareDisplayName -> +vi.mock('@opentrons/shared-data') describe('getLocationInfoNames', () => { beforeEach(() => { - mockGetLabwareDisplayName.mockReturnValue(LABWARE_DISPLAY_NAME) + vi.mocked(getLabwareDisplayName).mockReturnValue(LABWARE_DISPLAY_NAME) }) it('returns labware name and slot number for labware id on the deck', () => { const expected = { diff --git a/app/src/organisms/Devices/ProtocolRun/utils/__tests__/getSlotLabwareDefinition.test.ts b/app/src/organisms/Devices/ProtocolRun/utils/__tests__/getSlotLabwareDefinition.test.ts index 120a236523e..973f50f5d61 100644 --- a/app/src/organisms/Devices/ProtocolRun/utils/__tests__/getSlotLabwareDefinition.test.ts +++ b/app/src/organisms/Devices/ProtocolRun/utils/__tests__/getSlotLabwareDefinition.test.ts @@ -1,3 +1,4 @@ +import { describe, it, expect } from 'vitest' import { RunTimeCommand } from '@opentrons/shared-data' import { mockDefinition } from '../../../../../redux/custom-labware/__fixtures__' import { getSlotLabwareDefinition } from '../getSlotLabwareDefinition'