forked from canada-ca/tracker
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOrganizationCard.test.js
More file actions
88 lines (80 loc) · 2 KB
/
OrganizationCard.test.js
File metadata and controls
88 lines (80 loc) · 2 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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
import React from 'react'
import { render } from '@testing-library/react'
import { MemoryRouter } from 'react-router-dom'
import { List, theme, ChakraProvider } from '@chakra-ui/react'
import { I18nProvider } from '@lingui/react'
import { MockedProvider } from '@apollo/client/testing'
import { setupI18n } from '@lingui/core'
import { en } from 'make-plural/plurals'
import { OrganizationCard } from '../OrganizationCard'
import { matchMediaSize } from '../../helpers/matchMedia'
matchMediaSize()
const i18n = setupI18n({
locale: 'en',
messages: {
en: {},
},
localeData: {
en: { plurals: en },
},
})
const summaries = {
mail: {
total: 23452,
categories: [
{
name: 'pass',
count: 6577,
percentage: 23.4,
},
{
name: 'fail',
count: 7435,
percentage: 43.5,
},
],
},
web: {
total: 57896,
categories: [
{
name: 'pass',
count: 6577,
percentage: 23.4,
},
{
name: 'fail',
count: 7435,
percentage: 43.5,
},
],
},
}
describe('<OrganizationsCard />', () => {
it('successfully renders card with org name and number of services', async () => {
const { getByText } = render(
<MockedProvider>
<MemoryRouter initialEntries={['/']}>
<ChakraProvider theme={theme}>
<I18nProvider i18n={i18n}>
<List>
<OrganizationCard
slug="tbs-sct-gc-ca"
name="Treasury Board Secretariat"
acronym="TBS"
domainCount={7}
verified={false}
summaries={summaries}
/>
</List>
</I18nProvider>
</ChakraProvider>
</MemoryRouter>
</MockedProvider>,
)
const orgName = getByText(/Treasury Board Secretariat/i)
expect(orgName).toBeDefined()
const domainCount = getByText(/Services: 7/i)
expect(domainCount).toBeDefined()
})
})