import { POST , DELETE , GET } from '../../robot-api' ; import { makeResponseFixtures , mockV2ErrorResponse , } from '../../robot-api/__fixtures__' ; import { mockRobotCalibrationCheckSessionDetails , mockRobotCalibrationCheckSessionParams , } from './calibration-check' ; import { mockTipLengthCalibrationSessionDetails , mockTipLengthCalibrationSessionParams , } from './tip-length-calibration' ; import { mockDeckCalibrationSessionDetails } from './deck-calibration' ; import { mockPipetteOffsetCalibrationSessionDetails , mockPipetteOffsetCalibrationSessionParams , } from './pipette-offset-calibration' ; import type { ResponseFixtures } from '../../robot-api/__fixtures__' ; import type { RobotApiV2ErrorResponseBody } from '../../robot-api/types' ; import * as Types from '../types' ; import * as Constants from '../constants' ; export * from './calibration-check' ; export * from './tip-length-calibration' ; export * from './deck-calibration' ; export const mockSessionId = 'fake_session_id' ; export const mockOtherSessionId = 'other_fake_session_id' ; export const mockCalibrationCheckSessionAttributes = { sessionType : Constants . SESSION_TYPE_CALIBRATION_HEALTH_CHECK , createParams : mockRobotCalibrationCheckSessionParams , details : mockRobotCalibrationCheckSessionDetails , } ; export const mockTipLengthCalibrationSessionAttributes = { sessionType : Constants . SESSION_TYPE_TIP_LENGTH_CALIBRATION , createParams : mockTipLengthCalibrationSessionParams , details : mockTipLengthCalibrationSessionDetails , } ; export const mockDeckCalibrationSessionAttributes = { sessionType : Constants . SESSION_TYPE_DECK_CALIBRATION , createParams : { } , details : mockDeckCalibrationSessionDetails , } ; export const mockPipetteOffsetCalibrationSessionAttributes = { sessionType : Constants . SESSION_TYPE_PIPETTE_OFFSET_CALIBRATION , createParams : mockPipetteOffsetCalibrationSessionParams , details : mockPipetteOffsetCalibrationSessionDetails , } ; export const mockSession = { ... mockCalibrationCheckSessionAttributes , id : mockSessionId , } ; export const mockSessionCommand = { command : 'calibration.jog' , data : { vector : [ 32 , 0 , 0 ] } , } ; export const mockSessionCommandAttributes = { command : 'calibration.check.comparePoint' , data : { } , } ; export const mockSessionResponse = { data : { ... mockCalibrationCheckSessionAttributes , id : mockSessionId , } , } ; export const mockTipLengthCalibrationSessionResponse = { data : { ... mockTipLengthCalibrationSessionAttributes , id : mockSessionId , } , } ; export const mockPipetteOffsetCalibrationSessionResponse = { data : { ... mockPipetteOffsetCalibrationSessionAttributes , id : mockSessionId , } , } ; export const mockDeckCalibrationSessionResponse = { data : { ... mockDeckCalibrationSessionAttributes , id : mockSessionId , } , } ; export const mockMultiSessionResponse = { data : [ { ... mockCalibrationCheckSessionAttributes , id : mockSessionId , } , { ... mockCalibrationCheckSessionAttributes , id : mockOtherSessionId , } , ] , } ; export const mockSessionCommandResponse = { data : { ... mockSessionCommandAttributes , id : mockSessionId , } , } ; export const { successMeta : mockCreateSessionSuccessMeta , failureMeta : mockCreateSessionFailureMeta , success : mockCreateSessionSuccess , failure : mockCreateSessionFailure , } = makeResponseFixtures ( { method : POST , path : Constants . SESSIONS_PATH , successStatus : 201 , successBody : mockSessionResponse , failureStatus : 500 , failureBody : mockV2ErrorResponse , } ) ; export const { successMeta : mockDeleteSessionSuccessMeta , failureMeta : mockDeleteSessionFailureMeta , success : mockDeleteSessionSuccess , failure : mockDeleteSessionFailure , } = makeResponseFixtures ( { method : DELETE , path : `${ Constants . SESSIONS_PATH }/${ mockSessionId }` , successStatus : 200 , successBody : mockSessionResponse , failureStatus : 500 , failureBody : mockV2ErrorResponse , } ) ; export const { successMeta : mockDeleteTipLengthCalibrationSessionSuccessMeta , failureMeta : mockDeleteTipLengthCalibrationSessionFailureMeta , success : mockDeleteTipLengthCalibrationSessionSuccess , failure : mockDeleteTipLengthCalibrationSessionFailure , } = makeResponseFixtures ( { method : DELETE , path : `${ Constants . SESSIONS_PATH }/${ mockSessionId }` , successStatus : 200 , successBody : mockTipLengthCalibrationSessionResponse , failureStatus : 500 , failureBody : mockV2ErrorResponse , } ) ; export const { successMeta : mockDeletePipetteOffsetCalibrationSessionSuccessMeta , failureMeta : mockDeletePipetteOffsetCalibrationSessionFailureMeta , success : mockDeletePipetteOffsetCalibrationSessionSuccess , failure : mockDeletePipetteOffsetCalibrationSessionFailure , } = makeResponseFixtures ( { method : DELETE , path : `${ Constants . SESSIONS_PATH }/${ mockSessionId }` , successStatus : 200 , successBody : mockPipetteOffsetCalibrationSessionResponse , failureStatus : 500 , failureBody : mockV2ErrorResponse , } ) ; export const { successMeta : mockDeleteDeckCalibrationSessionSuccessMeta , failureMeta : mockDeleteDeckCalibrationSessionFailureMeta , success : mockDeleteDeckCalibrationSessionSuccess , failure : mockDeleteDeckCalibrationSessionFailure , } = makeResponseFixtures ( { method : DELETE , path : `${ Constants . SESSIONS_PATH }/${ mockSessionId }` , successStatus : 200 , successBody : mockDeckCalibrationSessionResponse , failureStatus : 500 , failureBody : mockV2ErrorResponse , } ) ; export const { successMeta : mockFetchSessionSuccessMeta , failureMeta : mockFetchSessionFailureMeta , success : mockFetchSessionSuccess , failure : mockFetchSessionFailure , } = makeResponseFixtures ( { method : GET , path : `${ Constants . SESSIONS_PATH }/${ mockSessionId }` , successStatus : 200 , successBody : mockSessionResponse , failureStatus : 500 , failureBody : mockV2ErrorResponse , } ) ; export const { successMeta : mockFetchAllSessionsSuccessMeta , failureMeta : mockFetchAllSessionsFailureMeta , success : mockFetchAllSessionsSuccess , failure : mockFetchAllSessionsFailure , } = makeResponseFixtures ( { method : GET , path : Constants . SESSIONS_PATH , successStatus : 200 , successBody : mockMultiSessionResponse , failureStatus : 500 , failureBody : mockV2ErrorResponse , } ) ; export const { successMeta : mockSessionCommandsSuccessMeta , failureMeta : mockSessionCommandsFailureMeta , success : mockSessionCommandsSuccess , failure : mockSessionCommandsFailure , } = makeResponseFixtures ( { method : GET , path : `${ Constants . SESSIONS_PATH }/${ mockSessionId }/${ Constants . SESSIONS_COMMANDS_PATH_EXTENSION }` , successStatus : 200 , successBody : mockSessionCommandResponse , failureStatus : 500 , failureBody : mockV2ErrorResponse , } ) ;