fhir-react 0.3.5 → 0.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/build/index.js +6 -6
- package/package.json +1 -1
- package/src/assets/containers/{Medication/medication.svg → MedicationOrder/medication-order.svg} +0 -0
- package/src/assets/containers/MedicationRequest/medication-request.svg +5 -0
- package/src/assets/containers/ResourceCategory/{resource-placeholder.svg → resource-category.svg} +0 -0
- package/src/components/resources/AllergyIntolerance/AllergyIntolerance.js +3 -5
- package/src/components/resources/AllergyIntolerance/AllergyIntolerance.stories.js +5 -4
- package/src/components/resources/AllergyIntolerance/AllergyIntolerance.test.js +71 -0
- package/src/components/resources/Binary/Binary.js +1 -2
- package/src/components/resources/Binary/Binary.stories.js +10 -4
- package/src/components/resources/Binary/Binary.test.js +67 -0
- package/src/components/resources/CarePlan/CarePlan.stories.js +31 -5
- package/src/components/resources/CarePlan/CarePlan.test.js +72 -0
- package/src/components/resources/Device/Device.stories.js +33 -5
- package/src/components/resources/Device/Device.test.js +72 -0
- package/src/components/resources/DiagnosticReport/DiagnosticReport.stories.js +5 -4
- package/src/components/resources/DiagnosticReport/DiagnosticReport.test.js +71 -0
- package/src/components/resources/DocumentReference/DocumentReference.stories.js +3 -2
- package/src/components/resources/DocumentReference/DocumentReference.test.js +71 -0
- package/src/components/resources/FamilyMemberHistory/FamilyMemberHistory.stories.js +3 -2
- package/src/components/resources/FamilyMemberHistory/FamilyMemberHistory.test.js +72 -0
- package/src/components/resources/Goal/Goal.js +1 -2
- package/src/components/resources/Goal/Goal.stories.js +5 -4
- package/src/components/resources/Goal/Goal.test.js +69 -0
- package/src/components/resources/Medication/Medication.test.js +1 -1
- package/src/components/resources/MedicationKnowledge/MedicationKnowledge.js +1 -1
- package/src/components/resources/MedicationOrder/MedicationOrder.js +2 -2
- package/src/components/resources/MedicationOrder/MedicationOrder.stories.js +1 -2
- package/src/components/resources/MedicationOrder/MedicationOrder.test.js +67 -0
- package/src/components/resources/MedicationRequest/MedicationRequest.js +2 -4
- package/src/components/resources/MedicationRequest/MedicationRequest.stories.js +11 -6
- package/src/components/resources/MedicationRequest/MedicationRequest.test.js +67 -0
- package/src/components/resources/MedicationStatement/MedicationDosage.js +2 -2
- package/src/components/resources/MedicationStatement/MedicationStatement.js +1 -0
- package/src/components/resources/MedicationStatement/MedicationStatement.stories.js +5 -4
- package/src/components/resources/MedicationStatement/MedicationStatement.test.js +72 -0
- package/src/components/resources/ResourceCategory/ResourceCategory.js +7 -12
- package/src/components/resources/ResourceCategory/ResourceCategory.stories.js +13 -2
- package/src/components/resources/ResourceCategory/ResourceCategory.test.js +77 -18
- package/src/fixtures/example-icons.jsx +20 -13
|
@@ -8,8 +8,75 @@ import stu3Example2 from '../../../fixtures/stu3/resources/medicationRequest/exa
|
|
|
8
8
|
import r4Example1 from '../../../fixtures/r4/resources/medicationRequest/example1.json';
|
|
9
9
|
import r4Example2 from '../../../fixtures/r4/resources/medicationRequest/example2.json';
|
|
10
10
|
import r4Example3 from '../../../fixtures/r4/resources/medicationRequest/example3.json';
|
|
11
|
+
import fhirIcons from '../../../fixtures/example-icons';
|
|
11
12
|
|
|
12
13
|
describe('should render MedicationRequest component properly', () => {
|
|
14
|
+
it('component without a fhirIcons props should render a default icon', () => {
|
|
15
|
+
const defaultProps = {
|
|
16
|
+
fhirResource: stu3Example1,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const { getByAltText } = render(<MedicationRequest {...defaultProps} />);
|
|
20
|
+
const headerIcon = getByAltText('medication request');
|
|
21
|
+
|
|
22
|
+
expect(headerIcon.getAttribute('src')).toContain('IMAGE_MOCK');
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('component with a false as a fhirIcons props should render a placeholder', () => {
|
|
26
|
+
const defaultProps = {
|
|
27
|
+
fhirResource: stu3Example1,
|
|
28
|
+
fhirIcons: false,
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const { getByTestId } = render(<MedicationRequest {...defaultProps} />);
|
|
32
|
+
const headerIcon = getByTestId('placeholder');
|
|
33
|
+
|
|
34
|
+
expect(headerIcon).toBeTruthy();
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it('component with the img as a fhirIcons props should render an img', () => {
|
|
38
|
+
const defaultProps = {
|
|
39
|
+
fhirResource: stu3Example1,
|
|
40
|
+
fhirIcons: (
|
|
41
|
+
<img
|
|
42
|
+
src={require('../assets/containers/MedicationOrder/medication-request.svg')}
|
|
43
|
+
alt="medication request"
|
|
44
|
+
/>
|
|
45
|
+
),
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const { getByAltText } = render(<MedicationRequest {...defaultProps} />);
|
|
49
|
+
const headerIcon = getByAltText('medication request');
|
|
50
|
+
|
|
51
|
+
expect(headerIcon.getAttribute('src')).toContain('IMAGE_MOCK');
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it('component with the resources object as a fhirIcons props should render an img', () => {
|
|
55
|
+
const defaultProps = {
|
|
56
|
+
fhirResource: stu3Example1,
|
|
57
|
+
fhirIcons: fhirIcons,
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const { getByAltText } = render(<MedicationRequest {...defaultProps} />);
|
|
61
|
+
const headerIcon = getByAltText('medication request');
|
|
62
|
+
|
|
63
|
+
expect(headerIcon.getAttribute('src')).toContain('IMAGE_MOCK');
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
it('component with the url as a fhirIcons props should render an img', () => {
|
|
67
|
+
const avatarSrc =
|
|
68
|
+
'https://www.gravatar.com/avatar/?s=50&r=any&default=identicon&forcedefault=1';
|
|
69
|
+
const defaultProps = {
|
|
70
|
+
fhirResource: stu3Example1,
|
|
71
|
+
fhirIcons: avatarSrc,
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const { getByAltText } = render(<MedicationRequest {...defaultProps} />);
|
|
75
|
+
const headerIcon = getByAltText('header icon');
|
|
76
|
+
|
|
77
|
+
expect(headerIcon.getAttribute('src')).toContain(avatarSrc);
|
|
78
|
+
});
|
|
79
|
+
|
|
13
80
|
it('should render with STU3 source data', () => {
|
|
14
81
|
const defaultProps = {
|
|
15
82
|
fhirResource: stu3Example1,
|
|
@@ -3,7 +3,7 @@ import React from 'react';
|
|
|
3
3
|
import _get from 'lodash/get';
|
|
4
4
|
|
|
5
5
|
const MedicationDosage = props => {
|
|
6
|
-
const { dosage, hasNote, note,
|
|
6
|
+
const { dosage, hasNote, note, itemNumber } = props;
|
|
7
7
|
|
|
8
8
|
const instructions = _get(dosage, 'text');
|
|
9
9
|
const additionalInstructionText = _get(
|
|
@@ -16,7 +16,7 @@ const MedicationDosage = props => {
|
|
|
16
16
|
const hasRoute = route.trim() !== '';
|
|
17
17
|
|
|
18
18
|
return (
|
|
19
|
-
<ValueSection label="Dosage" key={
|
|
19
|
+
<ValueSection label="Dosage" key={itemNumber}>
|
|
20
20
|
<ValueSectionItem label="Instructions" data-testid="dosageInstruction">
|
|
21
21
|
{instructions}
|
|
22
22
|
</ValueSectionItem>
|
|
@@ -10,6 +10,7 @@ import stu3Example2 from '../../../fixtures/stu3/resources/medicationStatement/e
|
|
|
10
10
|
import r4Example1 from '../../../fixtures/r4/resources/medicationStatement/example1.json';
|
|
11
11
|
import r4Example2 from '../../../fixtures/r4/resources/medicationStatement/example2.json';
|
|
12
12
|
import fhirIcons from '../../../fixtures/example-icons';
|
|
13
|
+
import MedicationStatementIcon from '../../../assets/containers/MedicationStatement/medication-statement.svg';
|
|
13
14
|
|
|
14
15
|
export default {
|
|
15
16
|
title: 'MedicationStatement',
|
|
@@ -21,7 +22,7 @@ export const DefaultVisualizationDSTU2 = () => {
|
|
|
21
22
|
<MedicationStatement
|
|
22
23
|
fhirVersion={fhirVersions.DSTU2}
|
|
23
24
|
fhirResource={fhirResource}
|
|
24
|
-
fhirIcons={
|
|
25
|
+
fhirIcons={require('../../../assets/containers/MedicationStatement/medication-statement.svg')}
|
|
25
26
|
/>
|
|
26
27
|
);
|
|
27
28
|
};
|
|
@@ -32,7 +33,7 @@ export const ExampleOfSTU3 = () => {
|
|
|
32
33
|
<MedicationStatement
|
|
33
34
|
fhirVersion={fhirVersions.STU3}
|
|
34
35
|
fhirResource={fhirResource}
|
|
35
|
-
fhirIcons={
|
|
36
|
+
fhirIcons={MedicationStatementIcon}
|
|
36
37
|
/>
|
|
37
38
|
);
|
|
38
39
|
};
|
|
@@ -54,7 +55,7 @@ export const Example1OfR4 = () => {
|
|
|
54
55
|
<MedicationStatement
|
|
55
56
|
fhirVersion={fhirVersions.R4}
|
|
56
57
|
fhirResource={fhirResource}
|
|
57
|
-
fhirIcons={
|
|
58
|
+
fhirIcons={false}
|
|
58
59
|
/>
|
|
59
60
|
);
|
|
60
61
|
};
|
|
@@ -65,7 +66,7 @@ export const Example2OfR4 = () => {
|
|
|
65
66
|
<MedicationStatement
|
|
66
67
|
fhirVersion={fhirVersions.R4}
|
|
67
68
|
fhirResource={fhirResource}
|
|
68
|
-
fhirIcons={
|
|
69
|
+
fhirIcons={'random text'}
|
|
69
70
|
/>
|
|
70
71
|
);
|
|
71
72
|
};
|
|
@@ -5,8 +5,80 @@ import fhirVersions from '../fhirResourceVersions';
|
|
|
5
5
|
import example1MedicationStatement from '../../../fixtures/dstu2/resources/medicationStatement/example1.json';
|
|
6
6
|
import stu3Example from '../../../fixtures/stu3/resources/medicationStatement/example1.json';
|
|
7
7
|
import r4Example1 from '../../../fixtures/r4/resources/medicationStatement/example1.json';
|
|
8
|
+
import fhirIcons from '../../../fixtures/example-icons';
|
|
8
9
|
|
|
9
10
|
describe('should render MedicationStatement component correctly', () => {
|
|
11
|
+
it('component without a fhirIcons props should render a default icon', () => {
|
|
12
|
+
const defaultProps = {
|
|
13
|
+
fhirResource: example1MedicationStatement,
|
|
14
|
+
fhirVersion: fhirVersions.DSTU2,
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const { getByAltText } = render(<MedicationStatement {...defaultProps} />);
|
|
18
|
+
const headerIcon = getByAltText('medication statement');
|
|
19
|
+
|
|
20
|
+
expect(headerIcon.getAttribute('src')).toContain('IMAGE_MOCK');
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
it('component with a false as a fhirIcons props should render a placeholder', () => {
|
|
24
|
+
const defaultProps = {
|
|
25
|
+
fhirResource: example1MedicationStatement,
|
|
26
|
+
fhirVersion: fhirVersions.DSTU2,
|
|
27
|
+
fhirIcons: false,
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const { getByTestId } = render(<MedicationStatement {...defaultProps} />);
|
|
31
|
+
const headerIcon = getByTestId('placeholder');
|
|
32
|
+
|
|
33
|
+
expect(headerIcon).toBeTruthy();
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
it('component with the img as a fhirIcons props should render an img', () => {
|
|
37
|
+
const defaultProps = {
|
|
38
|
+
fhirResource: example1MedicationStatement,
|
|
39
|
+
fhirVersion: fhirVersions.DSTU2,
|
|
40
|
+
fhirIcons: (
|
|
41
|
+
<img
|
|
42
|
+
src={require('../assets/containers/MedicationStatement/medication-statement.svg')}
|
|
43
|
+
alt="medication statement"
|
|
44
|
+
/>
|
|
45
|
+
),
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const { getByAltText } = render(<MedicationStatement {...defaultProps} />);
|
|
49
|
+
const headerIcon = getByAltText('medication statement');
|
|
50
|
+
|
|
51
|
+
expect(headerIcon.getAttribute('src')).toContain('IMAGE_MOCK');
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it('component with the resources object as a fhirIcons props should render an img', () => {
|
|
55
|
+
const defaultProps = {
|
|
56
|
+
fhirResource: example1MedicationStatement,
|
|
57
|
+
fhirVersion: fhirVersions.DSTU2,
|
|
58
|
+
fhirIcons: fhirIcons,
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const { getByAltText } = render(<MedicationStatement {...defaultProps} />);
|
|
62
|
+
const headerIcon = getByAltText('medication statement');
|
|
63
|
+
|
|
64
|
+
expect(headerIcon.getAttribute('src')).toContain('IMAGE_MOCK');
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
it('component with the url as a fhirIcons props should render an img', () => {
|
|
68
|
+
const avatarSrc =
|
|
69
|
+
'https://www.gravatar.com/avatar/?s=50&r=any&default=identicon&forcedefault=1';
|
|
70
|
+
const defaultProps = {
|
|
71
|
+
fhirResource: example1MedicationStatement,
|
|
72
|
+
fhirVersion: fhirVersions.DSTU2,
|
|
73
|
+
fhirIcons: avatarSrc,
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
const { getByAltText } = render(<MedicationStatement {...defaultProps} />);
|
|
77
|
+
const headerIcon = getByAltText('header icon');
|
|
78
|
+
|
|
79
|
+
expect(headerIcon.getAttribute('src')).toContain(avatarSrc);
|
|
80
|
+
});
|
|
81
|
+
|
|
10
82
|
it('with DSTU2 source data', () => {
|
|
11
83
|
const defaultProps = {
|
|
12
84
|
fhirResource: example1MedicationStatement,
|
|
@@ -1,22 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import HeaderIcon from '../../datatypes/HeaderIcon';
|
|
1
|
+
import { Header, Root } from '../../ui';
|
|
3
2
|
import React from 'react';
|
|
4
3
|
import PropTypes from 'prop-types';
|
|
5
|
-
import { isUrl } from '../../../utils/isUrl';
|
|
6
|
-
|
|
7
|
-
const ResourceCategory = props => {
|
|
8
|
-
const { title, itemsCount, fhirIcons } = props;
|
|
9
4
|
|
|
5
|
+
const ResourceCategory = ({ title, itemsCount, fhirIcons }) => {
|
|
10
6
|
const parseNumber = value =>
|
|
11
7
|
/^[1-9]+\d*$/.test(value) ? Number.parseInt(value) : null;
|
|
12
8
|
|
|
13
9
|
const getItemsCountLabel = () =>
|
|
14
10
|
`${parsedItemsCount} ${parsedItemsCount === 1 ? 'item' : 'items'}`;
|
|
15
11
|
|
|
16
|
-
const headerIcon = isUrl(fhirIcons)
|
|
17
|
-
? fhirIcons
|
|
18
|
-
: fhirIcons && fhirIcons['ResourceCategory'];
|
|
19
|
-
|
|
20
12
|
const parsedItemsCount = parseNumber(itemsCount);
|
|
21
13
|
|
|
22
14
|
return (
|
|
@@ -26,8 +18,11 @@ const ResourceCategory = props => {
|
|
|
26
18
|
className="btn d-flex align-items-center justify-content-between w-100 py-4 px-4 bg-white"
|
|
27
19
|
>
|
|
28
20
|
<div className="d-flex gap-2">
|
|
29
|
-
<
|
|
30
|
-
|
|
21
|
+
<Header
|
|
22
|
+
resourceName={'ResourceCategory'}
|
|
23
|
+
title={title}
|
|
24
|
+
icon={fhirIcons}
|
|
25
|
+
/>
|
|
31
26
|
</div>
|
|
32
27
|
<div className="d-flex gap-2 align-items-center">
|
|
33
28
|
{parsedItemsCount > 0 && (
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import ResourceCategory from './ResourceCategory';
|
|
3
3
|
import fhirIcons from '../../../fixtures/example-icons';
|
|
4
|
+
import ResourceCategoryIcon from '../../../assets/containers/ResourceCategory/resource-category.svg';
|
|
4
5
|
|
|
5
6
|
export default { title: 'ResourceCategory' };
|
|
6
7
|
|
|
@@ -9,7 +10,7 @@ export const ExampleWithAllProperties = () => {
|
|
|
9
10
|
<ResourceCategory
|
|
10
11
|
itemsCount={41}
|
|
11
12
|
title="Resource name"
|
|
12
|
-
fhirIcons={
|
|
13
|
+
fhirIcons={require('../../../assets/containers/ResourceCategory/resource-category.svg')}
|
|
13
14
|
/>
|
|
14
15
|
);
|
|
15
16
|
};
|
|
@@ -19,7 +20,7 @@ export const ExampleWith1Item = () => {
|
|
|
19
20
|
<ResourceCategory
|
|
20
21
|
itemsCount={'1'}
|
|
21
22
|
title="Resource name"
|
|
22
|
-
fhirIcons={
|
|
23
|
+
fhirIcons={ResourceCategoryIcon}
|
|
23
24
|
/>
|
|
24
25
|
);
|
|
25
26
|
};
|
|
@@ -27,3 +28,13 @@ export const ExampleWith1Item = () => {
|
|
|
27
28
|
export const ExampleWithoutItemsCount = () => {
|
|
28
29
|
return <ResourceCategory title="Resource name" fhirIcons={fhirIcons} />;
|
|
29
30
|
};
|
|
31
|
+
|
|
32
|
+
export const ExampleWith1ItemAndDisableIcon = () => {
|
|
33
|
+
return (
|
|
34
|
+
<ResourceCategory
|
|
35
|
+
itemsCount={'1'}
|
|
36
|
+
title="Resource name"
|
|
37
|
+
fhirIcons={false}
|
|
38
|
+
/>
|
|
39
|
+
);
|
|
40
|
+
};
|
|
@@ -5,42 +5,107 @@ import fhirIcons from '../../../fixtures/example-icons';
|
|
|
5
5
|
import ResourceCategory from './ResourceCategory';
|
|
6
6
|
|
|
7
7
|
describe('should render ResourceCategory component properly', () => {
|
|
8
|
-
|
|
8
|
+
it('component without a fhirIcons props should render a default icon', () => {
|
|
9
|
+
const defaultProps = {
|
|
10
|
+
itemsCount: '41',
|
|
11
|
+
title: 'Resource name',
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const { getByAltText } = render(<ResourceCategory {...defaultProps} />);
|
|
15
|
+
const headerIcon = getByAltText('resource category');
|
|
16
|
+
|
|
17
|
+
expect(headerIcon.getAttribute('src')).toContain('IMAGE_MOCK');
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it('component with a false as a fhirIcons props should render a placeholder', () => {
|
|
21
|
+
const defaultProps = {
|
|
22
|
+
itemsCount: '41',
|
|
23
|
+
title: 'Resource name',
|
|
24
|
+
fhirIcons: false,
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
const { getByTestId } = render(<ResourceCategory {...defaultProps} />);
|
|
28
|
+
const headerIcon = getByTestId('placeholder');
|
|
29
|
+
|
|
30
|
+
expect(headerIcon).toBeTruthy();
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it('component with the img as a fhirIcons props should render an img', () => {
|
|
34
|
+
const defaultProps = {
|
|
35
|
+
itemsCount: '41',
|
|
36
|
+
title: 'Resource name',
|
|
37
|
+
fhirIcons: (
|
|
38
|
+
<img
|
|
39
|
+
src={require('../assets/containers/ResourceCategory/resource-category.svg')}
|
|
40
|
+
alt="resource category"
|
|
41
|
+
/>
|
|
42
|
+
),
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const { getByAltText } = render(<ResourceCategory {...defaultProps} />);
|
|
46
|
+
const headerIcon = getByAltText('resource category');
|
|
47
|
+
|
|
48
|
+
expect(headerIcon.getAttribute('src')).toContain('IMAGE_MOCK');
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it('component with the resources object as a fhirIcons props should render an img', () => {
|
|
52
|
+
const defaultProps = {
|
|
53
|
+
itemsCount: '41',
|
|
54
|
+
title: 'Resource name',
|
|
55
|
+
fhirIcons: fhirIcons,
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const { getByAltText } = render(<ResourceCategory {...defaultProps} />);
|
|
59
|
+
const headerIcon = getByAltText('resource category');
|
|
60
|
+
|
|
61
|
+
expect(headerIcon.getAttribute('src')).toContain('IMAGE_MOCK');
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
it('component with the url as a fhirIcons props should render an img', () => {
|
|
65
|
+
const avatarSrc =
|
|
66
|
+
'https://www.gravatar.com/avatar/?s=50&r=any&default=identicon&forcedefault=1';
|
|
67
|
+
const defaultProps = {
|
|
68
|
+
itemsCount: '41',
|
|
69
|
+
title: 'Resource name',
|
|
70
|
+
fhirIcons: avatarSrc,
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const { getByAltText } = render(<ResourceCategory {...defaultProps} />);
|
|
74
|
+
const headerIcon = getByAltText('header icon');
|
|
75
|
+
|
|
76
|
+
expect(headerIcon.getAttribute('src')).toContain(avatarSrc);
|
|
77
|
+
});
|
|
9
78
|
|
|
10
|
-
it('should render ResourceCategory component with
|
|
79
|
+
it('should render ResourceCategory component with itemsCount > 1 correctly', () => {
|
|
11
80
|
const defaultProps = {
|
|
12
81
|
fhirIcons: fhirIcons,
|
|
13
82
|
itemsCount: '41',
|
|
14
83
|
title: 'Resource name',
|
|
15
84
|
};
|
|
16
85
|
|
|
17
|
-
const { container, getByTestId
|
|
86
|
+
const { container, getByTestId } = render(
|
|
18
87
|
<ResourceCategory {...defaultProps} />,
|
|
19
88
|
);
|
|
20
89
|
expect(container).not.toBeNull();
|
|
21
90
|
|
|
22
91
|
expect(getByTestId('itemsCount').textContent).toContain('41 items');
|
|
23
92
|
expect(getByTestId('title').textContent).toContain('Resource name');
|
|
24
|
-
const image = getByAltText(placeholderResource.alt);
|
|
25
|
-
expect(image.src).toContain(placeholderResource.src);
|
|
26
93
|
});
|
|
27
94
|
|
|
28
|
-
it('should render ResourceCategory component with
|
|
95
|
+
it('should render ResourceCategory component with itemsCount === 1 correctly', () => {
|
|
29
96
|
const defaultProps = {
|
|
30
97
|
fhirIcons: fhirIcons,
|
|
31
98
|
itemsCount: 1,
|
|
32
99
|
title: 'Resource name',
|
|
33
100
|
};
|
|
34
101
|
|
|
35
|
-
const { container, getByTestId
|
|
102
|
+
const { container, getByTestId } = render(
|
|
36
103
|
<ResourceCategory {...defaultProps} />,
|
|
37
104
|
);
|
|
38
105
|
expect(container).not.toBeNull();
|
|
39
106
|
|
|
40
107
|
expect(getByTestId('itemsCount').textContent).toContain('1 item');
|
|
41
108
|
expect(getByTestId('title').textContent).toContain('Resource name');
|
|
42
|
-
const image = getByAltText(placeholderResource.alt);
|
|
43
|
-
expect(image.src).toContain(placeholderResource.src);
|
|
44
109
|
});
|
|
45
110
|
|
|
46
111
|
it('should render ResourceCategory correctly with negative number passed as itemsCount', () => {
|
|
@@ -50,7 +115,7 @@ describe('should render ResourceCategory component properly', () => {
|
|
|
50
115
|
title: 'Resource name',
|
|
51
116
|
};
|
|
52
117
|
|
|
53
|
-
const { container, getByTestId,
|
|
118
|
+
const { container, getByTestId, queryByTestId } = render(
|
|
54
119
|
<ResourceCategory {...defaultProps} />,
|
|
55
120
|
);
|
|
56
121
|
expect(container).not.toBeNull();
|
|
@@ -58,8 +123,6 @@ describe('should render ResourceCategory component properly', () => {
|
|
|
58
123
|
const item = queryByTestId('itemsCount');
|
|
59
124
|
expect(item).toBeNull();
|
|
60
125
|
expect(getByTestId('title').textContent).toContain('Resource name');
|
|
61
|
-
const image = getByAltText(placeholderResource.alt);
|
|
62
|
-
expect(image.src).toContain(placeholderResource.src);
|
|
63
126
|
});
|
|
64
127
|
|
|
65
128
|
it('should render ResourceCategory correctly with invalid string passed as itemsCount', () => {
|
|
@@ -69,15 +132,13 @@ describe('should render ResourceCategory component properly', () => {
|
|
|
69
132
|
title: 'Resource name',
|
|
70
133
|
};
|
|
71
134
|
|
|
72
|
-
const { container, getByTestId,
|
|
135
|
+
const { container, getByTestId, queryByTestId } = render(
|
|
73
136
|
<ResourceCategory {...defaultProps} />,
|
|
74
137
|
);
|
|
75
138
|
expect(container).not.toBeNull();
|
|
76
139
|
const item = queryByTestId('itemsCount');
|
|
77
140
|
expect(item).toBeNull();
|
|
78
141
|
expect(getByTestId('title').textContent).toContain('Resource name');
|
|
79
|
-
const image = getByAltText(placeholderResource.alt);
|
|
80
|
-
expect(image.src).toContain(placeholderResource.src);
|
|
81
142
|
});
|
|
82
143
|
|
|
83
144
|
it('should render ResourceCategory correctly with floating point number passed as text in itemsCount', () => {
|
|
@@ -87,7 +148,7 @@ describe('should render ResourceCategory component properly', () => {
|
|
|
87
148
|
title: 'Resource name',
|
|
88
149
|
};
|
|
89
150
|
|
|
90
|
-
const { container, getByTestId,
|
|
151
|
+
const { container, getByTestId, queryByTestId } = render(
|
|
91
152
|
<ResourceCategory {...defaultProps} />,
|
|
92
153
|
);
|
|
93
154
|
expect(container).not.toBeNull();
|
|
@@ -95,7 +156,5 @@ describe('should render ResourceCategory component properly', () => {
|
|
|
95
156
|
const item = queryByTestId('itemsCount');
|
|
96
157
|
expect(item).toBeNull();
|
|
97
158
|
expect(getByTestId('title').textContent).toContain('Resource name');
|
|
98
|
-
const image = getByAltText(placeholderResource.alt);
|
|
99
|
-
expect(image.src).toContain(placeholderResource.src);
|
|
100
159
|
});
|
|
101
160
|
});
|
|
@@ -40,7 +40,7 @@ export default {
|
|
|
40
40
|
<img
|
|
41
41
|
className="header-icon__image"
|
|
42
42
|
src={require('../assets/containers/AllergyIntolerance/allergy-intolerance.svg')}
|
|
43
|
-
alt="
|
|
43
|
+
alt="allergy intolerance"
|
|
44
44
|
/>
|
|
45
45
|
),
|
|
46
46
|
Appointment: (
|
|
@@ -54,7 +54,7 @@ export default {
|
|
|
54
54
|
<img
|
|
55
55
|
className="header-icon__image"
|
|
56
56
|
src={require('../assets/containers/CarePlan/care-plan.svg')}
|
|
57
|
-
alt="
|
|
57
|
+
alt="care plan"
|
|
58
58
|
/>
|
|
59
59
|
),
|
|
60
60
|
CareTeam: (
|
|
@@ -82,21 +82,21 @@ export default {
|
|
|
82
82
|
<img
|
|
83
83
|
className="header-icon__image"
|
|
84
84
|
src={require('../assets/containers/Device/device.svg')}
|
|
85
|
-
alt="
|
|
85
|
+
alt="device"
|
|
86
86
|
/>
|
|
87
87
|
),
|
|
88
88
|
DiagnosticReport: (
|
|
89
89
|
<img
|
|
90
90
|
className="header-icon__image"
|
|
91
91
|
src={require('../assets/containers/DiagnosticReport/diagnostic-report.svg')}
|
|
92
|
-
alt="
|
|
92
|
+
alt="diagnostic report"
|
|
93
93
|
/>
|
|
94
94
|
),
|
|
95
95
|
DocumentReference: (
|
|
96
96
|
<img
|
|
97
97
|
className="header-icon__image"
|
|
98
98
|
src={require('../assets/containers/DocumentReference/document-reference.svg')}
|
|
99
|
-
alt="
|
|
99
|
+
alt="document reference"
|
|
100
100
|
/>
|
|
101
101
|
),
|
|
102
102
|
Encounter: (
|
|
@@ -117,14 +117,14 @@ export default {
|
|
|
117
117
|
<img
|
|
118
118
|
className="header-icon__image"
|
|
119
119
|
src={require('../assets/containers/FamilyMemberHistory/family-member-history.svg')}
|
|
120
|
-
alt="
|
|
120
|
+
alt="family member history"
|
|
121
121
|
/>
|
|
122
122
|
),
|
|
123
123
|
Goal: (
|
|
124
124
|
<img
|
|
125
125
|
className="header-icon__image"
|
|
126
126
|
src={require('../assets/containers/Goal/goal.svg')}
|
|
127
|
-
alt="
|
|
127
|
+
alt="goal"
|
|
128
128
|
/>
|
|
129
129
|
),
|
|
130
130
|
List: (
|
|
@@ -141,11 +141,18 @@ export default {
|
|
|
141
141
|
alt="location marker"
|
|
142
142
|
/>
|
|
143
143
|
),
|
|
144
|
-
|
|
144
|
+
MedicationOrder: (
|
|
145
145
|
<img
|
|
146
146
|
className="header-icon__image"
|
|
147
|
-
src={require('../assets/containers/
|
|
148
|
-
alt="
|
|
147
|
+
src={require('../assets/containers/MedicationOrder/medication-order.svg')}
|
|
148
|
+
alt="medication order"
|
|
149
|
+
/>
|
|
150
|
+
),
|
|
151
|
+
MedicationRequest: (
|
|
152
|
+
<img
|
|
153
|
+
className="header-icon__image"
|
|
154
|
+
src={require('../assets/containers/MedicationRequest/medication-request.svg')}
|
|
155
|
+
alt="medication request"
|
|
149
156
|
/>
|
|
150
157
|
),
|
|
151
158
|
MedicationAdministration: (
|
|
@@ -166,7 +173,7 @@ export default {
|
|
|
166
173
|
<img
|
|
167
174
|
className="header-icon__image"
|
|
168
175
|
src={require('../assets/containers/MedicationStatement/medication-statement.svg')}
|
|
169
|
-
alt="
|
|
176
|
+
alt="medication statement"
|
|
170
177
|
/>
|
|
171
178
|
),
|
|
172
179
|
Observation: (
|
|
@@ -200,8 +207,8 @@ export default {
|
|
|
200
207
|
ResourceCategory: (
|
|
201
208
|
<img
|
|
202
209
|
className="header-icon__image"
|
|
203
|
-
src={require('../assets/containers/ResourceCategory/resource-
|
|
204
|
-
alt="
|
|
210
|
+
src={require('../assets/containers/ResourceCategory/resource-category.svg')}
|
|
211
|
+
alt="resource category"
|
|
205
212
|
/>
|
|
206
213
|
),
|
|
207
214
|
Patient: (
|