Skip to content

Commit 488cace

Browse files
committed
Add basic TreeNode tests
1 parent a8a1757 commit 488cace

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

test/TreeNode.js

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import React from 'react';
2+
import { shallow } from 'enzyme';
3+
import { assert } from 'chai';
4+
5+
import TreeNode from '../src/js/TreeNode';
6+
7+
describe('<TreeNode />', () => {
8+
describe('component', () => {
9+
it('should render the rct-node container', () => {
10+
const wrapper = shallow(
11+
<TreeNode
12+
checked={0}
13+
expanded={false}
14+
label="Europa"
15+
optimisticToggle
16+
treeId="id"
17+
value="europa"
18+
onCheck={() => {}}
19+
onExpand={() => {}}
20+
/>,
21+
);
22+
23+
assert.isTrue(wrapper.find('.rct-node').exists());
24+
});
25+
});
26+
27+
describe('label', () => {
28+
it('should render the node\'s label', () => {
29+
const wrapper = shallow(
30+
<TreeNode
31+
checked={0}
32+
expanded={false}
33+
label="Europa"
34+
optimisticToggle
35+
treeId="id"
36+
value="europa"
37+
onCheck={() => {}}
38+
onExpand={() => {}}
39+
/>,
40+
);
41+
42+
assert.isTrue(wrapper.contains(
43+
<span className="rct-title">Europa</span>,
44+
));
45+
});
46+
});
47+
});

0 commit comments

Comments
 (0)