-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgetTree.spec.js
39 lines (36 loc) · 1.28 KB
/
getTree.spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
const { expect } = require('chai')
const { mount } = require('enzyme')
const { Map, Set } = require('immutable')
const React = require('react')
const getNode = require('./getNode')
const getTree = require('./getTree')
describe('getTree()', function() {
const Node = getNode(() => <div />)
let options
beforeEach(function() {
options = {
childParentMap: this.childParentMap,
disabledNodes: new Set(),
hiddenNodes: new Set(),
nodePropsMap: new Map({
a0: new Map({ name: 'A0' }),
a1: new Map({ name: 'A1' }),
b1: new Map({ name: 'B1' }),
a2: new Map({ name: 'A2' }),
b2: new Map({ name: 'B2' }),
c2: new Map({ name: 'C2' }),
d2: new Map({ name: 'D2' }),
a3: new Map({ name: 'A3' }),
b3: new Map({ name: 'B3' }),
}),
selectedNodes: new Set(),
unselectableNodes: new Set(),
}
})
it('should pass on the node props', function() {
const Tree = getTree(Node)
const wrapper = mount(<Tree {...options} />)
const firstNodeWrapper = wrapper.find(Node).first()
expect(firstNodeWrapper.prop('name')).to.equal('A0')
})
})