-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(app): usb connection and moam modal functionality in module setup (
#8257) * feat(app): usb connection and moam modal functionality in module setup
- Loading branch information
Showing
8 changed files
with
463 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
app/src/organisms/ProtocolSetup/RunSetupCard/ModuleSetup/__tests__/ModuleInfo.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import React from 'react' | ||
import '@testing-library/jest-dom' | ||
import { ModuleModel, ModuleRealType } from '@opentrons/shared-data' | ||
import { ModuleInfo } from '../ModuleInfo' | ||
import { renderWithProviders } from '@opentrons/components/__utils__' | ||
import { i18n } from '../../../../../i18n' | ||
|
||
const render = (props: React.ComponentProps<typeof ModuleInfo>) => { | ||
return renderWithProviders(<ModuleInfo {...props} />, { | ||
i18nInstance: i18n, | ||
}) | ||
} | ||
const STUBBED_ORIENTATION_VALUE = 'left' | ||
const mockTCModule = { | ||
labwareOffset: { x: 3, y: 3, z: 3 }, | ||
moduleId: 'TCModuleId', | ||
model: 'thermocyclerModuleV1' as ModuleModel, | ||
type: 'thermocyclerModuleType' as ModuleRealType, | ||
} | ||
|
||
describe('ModuleInfo', () => { | ||
let props: React.ComponentProps<typeof ModuleInfo> | ||
beforeEach(() => { | ||
props = { | ||
x: mockTCModule.labwareOffset.x, | ||
y: mockTCModule.labwareOffset.y, | ||
orientation: STUBBED_ORIENTATION_VALUE, | ||
moduleModel: mockTCModule.model, | ||
isAttached: false, | ||
usbPort: null, | ||
hubPort: null, | ||
} | ||
}) | ||
|
||
it('should show module not connected', () => { | ||
const { getByText } = render(props) | ||
expect(getByText('Not Connected')).toBeTruthy() | ||
}) | ||
|
||
it('should show module connected and hub number', () => { | ||
props = { ...props, usbPort: '1', hubPort: '1', isAttached: true } | ||
const { getByText } = render(props) | ||
expect(getByText('Connected')).toBeTruthy() | ||
expect(getByText('USB Port 1 via hub')).toBeTruthy() | ||
}) | ||
|
||
it('should show module connected and no USB number', () => { | ||
props = { ...props, usbPort: null, hubPort: null, isAttached: true } | ||
const { getByText } = render(props) | ||
expect(getByText('Connected')).toBeTruthy() | ||
expect(getByText('USB Port Connected')).toBeTruthy() | ||
}) | ||
|
||
it('should show module connected and USB number', () => { | ||
props = { ...props, usbPort: '1', hubPort: null, isAttached: true } | ||
const { getByText } = render(props) | ||
expect(getByText('Connected')).toBeTruthy() | ||
expect(getByText('USB Port 1')).toBeTruthy() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.