summaryrefslogtreecommitdiffstats
path: root/test/generic-components/treeNode
diff options
context:
space:
mode:
Diffstat (limited to 'test/generic-components/treeNode')
-rw-r--r--test/generic-components/treeNode/TreeNode.test.js41
1 files changed, 41 insertions, 0 deletions
diff --git a/test/generic-components/treeNode/TreeNode.test.js b/test/generic-components/treeNode/TreeNode.test.js
new file mode 100644
index 0000000..1c669e6
--- /dev/null
+++ b/test/generic-components/treeNode/TreeNode.test.js
@@ -0,0 +1,41 @@
+import TreeNode from 'generic-components/treeNode/TreeNode';
+import React from 'react';
+import { mount } from 'enzyme';
+
+describe('TreeNode', () => {
+ let treeNode;
+
+ beforeEach(() => {
+ treeNode = mount(<TreeNode node={{title: 'AAA'}}/>).instance();
+ });
+
+
+ it('Should be invisible when created', () => {
+ // then
+ expect(treeNode.state['visible']).toEqual(false)
+ });
+
+ it('Should be visible when toggled', () => {
+ // given
+ expect(treeNode.state['visible']).toEqual(false)
+
+ // when
+ treeNode.toggle();
+
+ // then
+ expect(treeNode.state['visible']).toEqual(true)
+ });
+
+ it('Should be invisible when double toggled', () => {
+ // given
+ expect(treeNode.state['visible']).toEqual(false);
+
+ // when
+ treeNode.toggle();
+ treeNode.toggle();
+
+ // then
+ expect(treeNode.state['visible']).toEqual(false);
+ });
+
+});