Skip to content

Commit

Permalink
fix test address feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
jerader committed Aug 20, 2024
1 parent b1cdb1c commit 6799aa7
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ export const DeckSetupTools = (props: DeckSetupToolsProps): JSX.Element => {

return (
<Toolbox
width="400px"
width="25rem"
title={t('customize_slot', { slotName: slot })}
closeButtonText={t('clear')}
onCloseClick={() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@ export const LabwareTools = (props: LabwareToolsProps): JSX.Element => {
{t('custom_labware')}
</StyledText>
<input
data-testid="customLabwareInput"
type="file"
onChange={e => {
setSelectedCategory(CUSTOM_CATEGORY)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,21 @@ import * as React from 'react'
import { describe, it, expect, vi, beforeEach } from 'vitest'
import '@testing-library/jest-dom/vitest'
import { fireEvent, screen } from '@testing-library/react'
import {
FLEX_ROBOT_TYPE,
HEATERSHAKER_MODULE_V1,
fixtureP1000SingleV2Specs,
fixtureTiprack1000ul,
} from '@opentrons/shared-data'
import { i18n } from '../../../localization'
import { renderWithProviders } from '../../../__testing-utils__'
import {
getInitialDeckSetup,
getPermittedTipracks,
getPipetteEntities,
} from '../../../step-forms/selectors'
import {
FLEX_ROBOT_TYPE,
HEATERSHAKER_MODULE_V1,
fixtureP1000SingleV2Specs,
fixtureTiprack1000ul,
} from '@opentrons/shared-data'
import { getHas96Channel } from '../../../utils'
import { createCustomLabwareDef } from '../../../labware-defs/actions'
import { getCustomLabwareDefsByURI } from '../../../labware-defs/selectors'
import { getRobotType } from '../../../file-data/selectors'
import { LabwareTools } from '../LabwareTools'
Expand All @@ -25,6 +26,7 @@ vi.mock('../../../utils')
vi.mock('../../../step-forms/selectors')
vi.mock('../../../file-data/selectors')
vi.mock('../../../labware-defs/selectors')
vi.mock('../../../labware-defs/actions')

const render = (props: React.ComponentProps<typeof LabwareTools>) => {
return renderWithProviders(<LabwareTools {...props} />, {
Expand Down Expand Up @@ -90,12 +92,19 @@ describe('LabwareTools', () => {
// set adapter
fireEvent.click(
screen.getByRole('label', {
name: 'Opentrons Universal Flat Heater-Shaker Adapter',
name: 'Fixture Opentrons Universal Flat Heater-Shaker Adapter',
})
)
// set labware
screen.getByText('Adapter compatible labware')
fireEvent.click(screen.getAllByRole('label')[1])
expect(props.setNestedSelectedLabwareDefURI).toHaveBeenCalled()
})

it('renders the custom labware flow', () => {
render(props)
screen.getByText('Add custom labware')
fireEvent.change(screen.getByTestId('customLabwareInput'))
expect(vi.mocked(createCustomLabwareDef)).toHaveBeenCalled()
})
})
12 changes: 9 additions & 3 deletions shared-data/js/__tests__/labwareDefSchemaV2.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,15 @@ describe('test schemas of all v2 labware fixtures', () => {
})

it(`fixture file name matches loadName: ${labwarePath}`, () => {
expect(labwareDef.parameters.loadName).toEqual(
path.basename(filename, '.json')
)
// filtering out this fixture since we need the exact loadName to test
// for PD's heater-shaker adapter/labware combos
if (
labwareDef.parameters.loadName !== 'opentrons_universal_flat_adapter'
) {
expect(labwareDef.parameters.loadName).toEqual(
path.basename(filename, '.json')
)
}
})

it(`namespace is "fixture": ${labwarePath}`, () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
]
},
"metadata": {
"displayName": "Corning 96 Well Plate 360 µL Flat",
"displayName": "Fixture Corning 96 Well Plate 360 µL Flat",
"displayCategory": "wellPlate",
"displayVolumeUnits": "µL",
"tags": []
Expand Down Expand Up @@ -1043,7 +1043,7 @@
"format": "96Standard",
"isTiprack": false,
"isMagneticModuleCompatible": false,
"loadName": "corning_96_wellplate_360ul_flat"
"loadName": "fixture_corning_96_wellplate_360_flat"
},
"namespace": "fixture",
"version": 2,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"brandId": []
},
"metadata": {
"displayName": "Opentrons Universal Flat Heater-Shaker Adapter",
"displayName": "Fixture Opentrons Universal Flat Heater-Shaker Adapter",
"displayCategory": "adapter",
"displayVolumeUnits": "\u00b5L",
"tags": []
Expand Down

0 comments on commit 6799aa7

Please sign in to comment.