forked from canada-ca/tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSummaryCard.test.js
More file actions
55 lines (52 loc) · 1.37 KB
/
SummaryCard.test.js
File metadata and controls
55 lines (52 loc) · 1.37 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
import React from 'react'
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 SummaryCard from '../SummaryCard'
const { data } = {
data: {
webSummary: {
categories: [
{
name: 'moderate',
count: 33,
percentage: 33,
},
{
name: 'strong',
count: 33,
percentage: 33,
},
{
name: 'weak',
count: 33,
percentage: 33,
},
],
total: 100,
},
},
}
describe('<SummaryCard />', () => {
it('renders three bars with the numbers from the test data', async () => {
const { getAllByText } = render(
<I18nProvider i18n={setupI18n()}>
<ThemeProvider theme={theme}>
<SummaryCard
title="title"
categoryDisplay={{
strong: { name: 'awesome', color: '#30362F' },
moderate: { name: 'meh', color: '#8B94A3' },
weak: { name: 'nah', color: '#0a8754' },
}}
description="description"
data={data.webSummary}
/>
</ThemeProvider>
</I18nProvider>,
)
const bars = await waitFor(() => getAllByText(/33 - 33%/i))
expect(bars).toHaveLength(3)
})
})