forked from canada-ca/tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInfoPanel.test.js
More file actions
53 lines (47 loc) · 1.46 KB
/
InfoPanel.test.js
File metadata and controls
53 lines (47 loc) · 1.46 KB
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
45
46
47
48
49
50
51
52
53
import React from 'react'
import { render, waitFor } from '@testing-library/react'
import { theme, ChakraProvider } from '@chakra-ui/react'
import { I18nProvider } from '@lingui/react'
import { setupI18n } from '@lingui/core'
import { en } from 'make-plural/plurals'
import { InfoButton, InfoBox, InfoPanel } from '../InfoPanel'
const i18n = setupI18n({
locale: 'en',
messages: {
en: {},
},
localeData: {
en: { plurals: en },
},
})
describe('<InfoPanel>', () => {
it('successfully renders with mocked data', async () => {
const isOpen = true
const { getByText } = render(
<ChakraProvider theme={theme}>
<I18nProvider i18n={i18n}>
<InfoPanel isOpen={isOpen}>
<InfoBox title="Domain" info="The domain address." />
<InfoBox
title="Total Messages"
info="Shows the total number of emails that have been sent by this domain during the selected time range."
/>
</InfoPanel>
</I18nProvider>
</ChakraProvider>,
)
await waitFor(() => getByText(/The domain address./i))
})
describe('<InfoButton>', () => {
it('successfully renders with mocked data', async () => {
const { getByLabelText } = render(
<ChakraProvider theme={theme}>
<I18nProvider i18n={i18n}>
<InfoButton />
</I18nProvider>
</ChakraProvider>,
)
await waitFor(() => getByLabelText(/Open glossary/i))
})
})
})