forked from canada-ca/tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSummaryGroup.test.js
More file actions
68 lines (65 loc) · 1.49 KB
/
SummaryGroup.test.js
File metadata and controls
68 lines (65 loc) · 1.49 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
import React from 'react'
import { MockedProvider } from '@apollo/client/testing'
import { render, waitFor } from '@testing-library/react'
import { theme, ThemeProvider } from '@chakra-ui/core'
import { I18nProvider } from '@lingui/react'
import { setupI18n } from '@lingui/core'
import { SummaryGroup } from '../SummaryGroup'
const i18n = setupI18n({
locale: 'en',
messages: {
en: {},
},
localeData: {
en: {},
},
})
const data = {
webSummary: {
categories: [
{
name: 'pass',
count: 7468,
percentage: 56.6,
},
{
name: 'fail',
count: 5738,
percentage: 43.4,
},
],
total: 13206,
},
mailSummary: {
categories: [
{
name: 'pass',
count: 2091,
percentage: 11.2,
},
{
name: 'fail',
count: 8604,
percentage: 46.2,
},
],
total: 18613,
},
}
describe('<SummaryGroup />', () => {
describe('given the data for web and email summaries', () => {
it('displays two summary cards', async () => {
const { getAllByText } = render(
<I18nProvider i18n={i18n}>
<ThemeProvider theme={theme}>
<MockedProvider>
<SummaryGroup web={data.webSummary} mail={data.mailSummary} />
</MockedProvider>
</ThemeProvider>
</I18nProvider>,
)
const summaries = await waitFor(() => getAllByText(/settings summary/i))
expect(summaries).toHaveLength(2)
})
})
})