Merge "Add tests to Inventory module"
[aai/sparky-fe.git] / test / generic-components / treeNode / TreeNode.test.js
1 import TreeNode from 'generic-components/treeNode/TreeNode';
2 import React from 'react';
3 import { mount } from 'enzyme';
4
5 describe('TreeNode', () => {
6   let treeNode;
7
8   beforeEach(() => {
9     treeNode = mount(<TreeNode node={{title: 'AAA'}}/>).instance();
10   });
11
12
13   it('Should be invisible when created', () => {
14     // then
15     expect(treeNode.state['visible']).toEqual(false)
16   });
17
18   it('Should be visible when toggled', () => {
19     // given
20     expect(treeNode.state['visible']).toEqual(false)
21
22     // when
23     treeNode.toggle();
24
25     // then
26     expect(treeNode.state['visible']).toEqual(true)
27   });
28
29   it('Should be invisible when double toggled', () => {
30     // given
31     expect(treeNode.state['visible']).toEqual(false);
32
33     // when
34     treeNode.toggle();
35     treeNode.toggle();
36
37     // then
38     expect(treeNode.state['visible']).toEqual(false);
39   });
40
41 });