-
Notifications
You must be signed in to change notification settings - Fork 180
/
Copy pathTimelineAlerts.test.tsx
44 lines (40 loc) · 1.64 KB
/
TimelineAlerts.test.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import { describe, it, vi, beforeEach, expect } from 'vitest'
import '@testing-library/jest-dom/vitest'
import { fireEvent, screen } from '@testing-library/react'
import { i18n } from '../../../../assets/localization'
import { renderWithProviders } from '../../../../__testing-utils__'
import { getRobotStateTimeline } from '../../../../file-data/selectors'
import { selectDesignerTab } from '../../../../file-data/actions'
import { TimelineAlerts } from '../TimelineAlerts'
vi.mock('../../../../file-data/selectors')
vi.mock('../../../../file-data/actions')
const render = () => {
return renderWithProviders(<TimelineAlerts />, {
i18nInstance: i18n,
})[0]
}
describe('TimelineAlerts', () => {
beforeEach(() => {
vi.mocked(getRobotStateTimeline).mockReturnValue({
timeline: {} as any,
errors: [{ message: 'mockMessage', type: 'INSUFFICIENT_TIPS' }],
})
})
it('renders the insufficient tips timeline error and clicking on the button turns it into the starting deck state terminal id ', () => {
render()
screen.getByText('Not enough tips to complete action')
screen.getByText(
'Add another tip rack to your deck or change your tip management during transfer and mix steps.'
)
fireEvent.click(screen.getByText('Edit starting deck'))
expect(vi.mocked(selectDesignerTab)).toHaveBeenCalled()
})
it('renders the no tip on pipette timeline error and the knowledge link', () => {
vi.mocked(getRobotStateTimeline).mockReturnValue({
timeline: {} as any,
errors: [{ message: 'mockMessage', type: 'NO_TIP_ON_PIPETTE' }],
})
render()
screen.getByText('No tip on pipette at start of step')
})
})