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
73 lines (71 loc) · 1.9 KB
/
SummaryGroup.test.js
File metadata and controls
73 lines (71 loc) · 1.9 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
69
70
71
72
73
import React from 'react'
import { MockedProvider } from '@apollo/client/testing'
import { render, waitFor } from '@testing-library/react'
import { ThemeProvider, theme } from '@chakra-ui/core'
import { I18nProvider } from '@lingui/react'
import { setupI18n } from '@lingui/core'
import { SummaryGroup } from '../SummaryGroup'
import { WEB_AND_EMAIL_SUMMARIES } from '../graphql/queries'
const mocks = [
{
request: {
query: WEB_AND_EMAIL_SUMMARIES,
},
result: {
data: {
webSummary: {
categories: [
{
name: 'full-pass',
count: 7468,
percentage: 56.6,
},
{
name: 'full-fail',
count: 5738,
percentage: 43.4,
},
],
total: 13206,
},
emailSummary: {
categories: [
{
name: 'full-pass',
count: 2091,
percentage: 11.2,
},
{
name: 'full-fail',
count: 8604,
percentage: 46.2,
},
{
name: 'partial-pass',
count: 7918,
percentage: 42.5,
},
],
total: 18613,
},
},
},
},
]
describe('<SummaryGroup />', () => {
describe('given the data for web and email summaries', () => {
it('displays two summary cards', async () => {
const { getAllByText } = render(
<I18nProvider i18n={setupI18n()}>
<ThemeProvider theme={theme}>
<MockedProvider mocks={mocks} addTypename={false}>
<SummaryGroup title="title" description="description" />
</MockedProvider>
</ThemeProvider>
</I18nProvider>,
)
const summaries = await waitFor(() => getAllByText(/Summary/i))
expect(summaries).toHaveLength(2)
})
})
})