import { thermocyclerSetTargetBlockTemperature } from '../commandCreators/atomic/thermocyclerSetTargetBlockTemperature' ; import { thermocyclerSetTargetLidTemperature } from '../commandCreators/atomic/thermocyclerSetTargetLidTemperature' ; import { thermocyclerAwaitBlockTemperature } from '../commandCreators/atomic/thermocyclerAwaitBlockTemperature' ; import { thermocyclerAwaitLidTemperature } from '../commandCreators/atomic/thermocyclerAwaitLidTemperature' ; import { thermocyclerDeactivateBlock } from '../commandCreators/atomic/thermocyclerDeactivateBlock' ; import { thermocyclerDeactivateLid } from '../commandCreators/atomic/thermocyclerDeactivateLid' ; import { thermocyclerRunProfile } from '../commandCreators/atomic/thermocyclerRunProfile' ; import { thermocyclerCloseLid } from '../commandCreators/atomic/thermocyclerCloseLid' ; import { thermocyclerOpenLid } from '../commandCreators/atomic/thermocyclerOpenLid' ; import { getSuccessResult } from '../fixtures' ; import type { AtomicProfileStep , ModuleOnlyParams , TemperatureParams , TCProfileParams , } from '@opentrons/shared-data/protocol/types/schemaV4' ; import type { CommandCreator } from '../types' ; const getRobotInitialState = ( ) : any => { return { } ; } ; const invariantContext = { } ; const module = 'someTCModuleId' ; const temperature = 42 ; const holdTime = 10 ; const volume = 10 ; const profile = [ { temperature , holdTime , } , ] ; describe ( 'thermocycler atomic commands' , ( ) => { const testCasesSetBlock = [ { commandCreator : thermocyclerSetTargetBlockTemperature , expectedType : 'thermocycler/setTargetBlockTemperature' , params : { module , temperature , } , } , ] ; const testCasesWithTempParam = [ { commandCreator : thermocyclerSetTargetLidTemperature , expectedType : 'thermocycler/setTargetLidTemperature' , params : { module , temperature , } , } , { commandCreator : thermocyclerAwaitBlockTemperature , expectedType : 'thermocycler/awaitBlockTemperature' , params : { module , temperature , } , } , { commandCreator : thermocyclerAwaitLidTemperature , expectedType : 'thermocycler/awaitLidTemperature' , params : { module , temperature , } , } , ] ; const testCasesModuleOnly = [ { commandCreator : thermocyclerDeactivateBlock , expectedType : 'thermocycler/deactivateBlock' , params : { module , } , } , { commandCreator : thermocyclerDeactivateLid , expectedType : 'thermocycler/deactivateLid' , params : { module , } , } , { commandCreator : thermocyclerCloseLid , expectedType : 'thermocycler/closeLid' , params : { module , } , } , { commandCreator : thermocyclerOpenLid , expectedType : 'thermocycler/openLid' , params : { module , } , } , ] ; const testCasesRunProfile = [ { commandCreator : thermocyclerRunProfile , expectedType : 'thermocycler/runProfile' , params : { module , profile , volume , } , } , ] ; const testParams = < P > ( { commandCreator , params , expectedType , } ) : void => { it ( `creates a single "${ expectedType }" command with the given params` , ( ) => { const robotInitialState = getRobotInitialState ( ) ; const result = commandCreator ( params , invariantContext , robotInitialState ) ; const res = getSuccessResult ( result ) ; expect ( res . commands ) . toEqual ( [ { command : expectedType , params , } , ] ) ; } ) ; } ; testCasesSetBlock . forEach ( testParams ) ; testCasesWithTempParam . forEach ( testParams ) ; testCasesModuleOnly . forEach ( testParams ) ; testCasesRunProfile . forEach ( testParams ) ; } ) ;