From 27fd1057ae501585c447860dc2b640259a7a0eff Mon Sep 17 00:00:00 2001 From: awudzins Date: Thu, 14 Feb 2019 12:28:42 +0100 Subject: Improve code coverage in TreeNode Improve code coverage in TreeNode Issue-ID: AAI-1618 Change-Id: Idec9566b108743c7c3a515d3f7fdce6f31b15324 Signed-off-by: adam.wudzinski --- test/generic-components/treeNode/TreeNode.test.js | 41 +++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 test/generic-components/treeNode/TreeNode.test.js 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().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); + }); + +}); -- cgit 1.2.3-korg