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
80 lines (75 loc) · 1.8 KB
/
OrganizationCard.test.js
File metadata and controls
80 lines (75 loc) · 1.8 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
import React from 'react'
import { render } from '@testing-library/react'
import { MemoryRouter } from 'react-router-dom'
import { theme, ThemeProvider } from '@chakra-ui/core'
import { I18nProvider } from '@lingui/react'
import { MockedProvider } from '@apollo/client/testing'
import { setupI18n } from '@lingui/core'
import { OrganizationCard } from '../OrganizationCard'
const i18n = setupI18n({
locale: 'en',
messages: {
en: {},
},
localeData: {
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={['/']}>
<ThemeProvider theme={theme}>
<I18nProvider i18n={i18n}>
<OrganizationCard
slug="tbs-sct-gc-ca"
name="Treasury Board Secretariat"
acronym="TBS"
domainCount={7}
verified={false}
summaries={summaries}
/>
</I18nProvider>
</ThemeProvider>
</MemoryRouter>
</MockedProvider>,
)
const orgName = getByText(/Treasury Board Secretariat/i)
expect(orgName).toBeDefined()
const domainCount = getByText(/Services: 7/i)
expect(domainCount).toBeDefined()
})
})