-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update app Devices/__tests__ to vitest
- Loading branch information
Showing
16 changed files
with
598 additions
and
846 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
import * as React from 'react' | ||
import { renderWithProviders } from '@opentrons/components' | ||
import { fireEvent } from '@testing-library/react' | ||
import { describe, it, expect, vi, beforeEach } from 'vitest' | ||
import '@testing-library/jest-dom/vitest' | ||
import { renderWithProviders } from '../../../__testing-utils__' | ||
import { fireEvent, screen } from '@testing-library/react' | ||
import { i18n } from '../../../i18n' | ||
import { ConnectionTroubleshootingModal } from '../ConnectionTroubleshootingModal' | ||
|
||
|
@@ -16,33 +18,37 @@ describe('ConnectionTroubleshootingModal', () => { | |
let props: React.ComponentProps<typeof ConnectionTroubleshootingModal> | ||
beforeEach(() => { | ||
props = { | ||
onClose: jest.fn(), | ||
onClose: vi.fn(), | ||
} | ||
}) | ||
it('should render correct text', () => { | ||
const { getByText, getByRole } = render(props) | ||
getByText('Why is this robot unavailable?') | ||
getByText( | ||
render(props) | ||
screen.getByText('Why is this robot unavailable?') | ||
screen.getByText( | ||
'If you’re having trouble with the robot’s connection, try these troubleshooting tasks. First, double check that the robot is powered on.' | ||
) | ||
getByText('Wait for a minute after connecting the robot to the computer') | ||
getByText('Make sure the robot is connected to this computer') | ||
getByText('If connecting wirelessly:') | ||
getByText('Check that the computer and robot are on the same network') | ||
getByText('If connecting via USB:') | ||
getByText('If you’re still having issues:') | ||
getByText('Restart the robot') | ||
getByText('Restart the app') | ||
getByText( | ||
screen.getByText( | ||
'Wait for a minute after connecting the robot to the computer' | ||
) | ||
screen.getByText('Make sure the robot is connected to this computer') | ||
screen.getByText('If connecting wirelessly:') | ||
screen.getByText( | ||
'Check that the computer and robot are on the same network' | ||
) | ||
screen.getByText('If connecting via USB:') | ||
screen.getByText('If you’re still having issues:') | ||
screen.getByText('Restart the robot') | ||
screen.getByText('Restart the app') | ||
screen.getByText( | ||
'If none of these work, contact Opentrons Support for help (via the question mark link in this app, or by emailing [email protected].)' | ||
) | ||
getByRole('link', { | ||
screen.getByRole('link', { | ||
name: 'Learn more about troubleshooting connection problems', | ||
}) | ||
}) | ||
it('should render button and button is clickable', () => { | ||
const { getByRole } = render(props) | ||
const btn = getByRole('button', { name: 'close' }) | ||
render(props) | ||
const btn = screen.getByRole('button', { name: 'close' }) | ||
fireEvent.click(btn) | ||
expect(props.onClose).toHaveBeenCalled() | ||
}) | ||
|
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
Oops, something went wrong.