-
Notifications
You must be signed in to change notification settings - Fork 264
Expand file tree
/
Copy pathManifestInfo.test.jsx
More file actions
52 lines (43 loc) · 1.65 KB
/
ManifestInfo.test.jsx
File metadata and controls
52 lines (43 loc) · 1.65 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
import { render, screen } from '@tests/utils/test-utils';
import { ManifestInfo } from '../../../src/components/ManifestInfo';
describe('ManifestInfo', () => {
const metadata = [{ label: 'some label', values: ['some value'] }];
describe('when metadata is present', () => {
beforeEach(() => {
render(
<ManifestInfo
manifestLabel="The Manifest Label"
manifestDescription="The Manifest Description"
manifestMetadata={metadata}
manifestSummary="The Manifest Summary"
/>,
);
});
it('renders the content in a CollapsibleSection', () => {
expect(screen.getByRole('heading', { level: 4 })).toHaveTextContent('Resource');
});
it('renders manifest label', () => {
expect(screen.getByRole('heading', { level: 5 })).toHaveTextContent('The Manifest Label');
});
it('renders manifest description in SanitizedHtml component', () => {
expect(screen.getByText('The Manifest Description')).toBeInTheDocument();
});
it('renders manifest summary in SanitizedHtml component', () => {
expect(screen.getByText('The Manifest Summary')).toBeInTheDocument();
});
it('renders manifest metadata in LabelValueMetadata component', () => {
expect(screen.getByText('some label')).toBeInTheDocument();
expect(screen.getByText('some value')).toBeInTheDocument();
});
});
describe('when metadata is not present', () => {
beforeEach(() => {
render(
<ManifestInfo />,
);
});
it('does not render empty elements elements', () => {
expect(screen.queryByRole('heading', { level: 5 })).not.toBeInTheDocument();
});
});
});