summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorawudzins <adam.wudzinski@nokia.com>2019-02-14 12:28:42 +0100
committerawudzins <adam.wudzinski@nokia.com>2019-02-14 12:28:42 +0100
commit27fd1057ae501585c447860dc2b640259a7a0eff (patch)
treec9c2cfbe099c37bc71d73258c792ff591ec0c8e1
parent20d0dc060ba6b264b82a265c487d350e498a5135 (diff)
Improve code coverage in TreeNode
Improve code coverage in TreeNode Issue-ID: AAI-1618 Change-Id: Idec9566b108743c7c3a515d3f7fdce6f31b15324 Signed-off-by: adam.wudzinski <adam.wudzinski@nokia.com>
-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);
+ });
+
+});