This repository has been archived by the owner on Feb 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 217
/
index.js
57 lines (48 loc) · 1.42 KB
/
index.js
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
/**
* External dependencies
*/
import TestRenderer from 'react-test-renderer';
/**
* Internal dependencies
*/
import ProductDetails from '..';
describe( 'ProductDetails', () => {
test( 'should render details', () => {
const details = [
{ name: 'Lorem', value: 'Ipsum' },
{ name: 'LOREM', value: 'Ipsum', display: 'IPSUM' },
{ value: 'Ipsum' },
];
const component = TestRenderer.create(
<ProductDetails details={ details } />
);
expect( component.toJSON() ).toMatchSnapshot();
} );
test( 'should not render hidden details', () => {
const details = [
{ name: 'Lorem', value: 'Ipsum', hidden: true },
{ name: 'LOREM', value: 'Ipsum', display: 'IPSUM' },
];
const component = TestRenderer.create(
<ProductDetails details={ details } />
);
expect( component.toJSON() ).toMatchSnapshot();
} );
test( 'should not rendering anything if all details are hidden', () => {
const details = [
{ name: 'Lorem', value: 'Ipsum', hidden: true },
{ name: 'LOREM', value: 'Ipsum', display: 'IPSUM', hidden: true },
];
const component = TestRenderer.create(
<ProductDetails details={ details } />
);
expect( component.toJSON() ).toMatchSnapshot();
} );
test( 'should not rendering anything if details is an empty array', () => {
const details = [];
const component = TestRenderer.create(
<ProductDetails details={ details } />
);
expect( component.toJSON() ).toMatchSnapshot();
} );
} );