import React from 'react'; import { mount } from 'enzyme'; import Tree from '../index'; import { calcRangeKeys } from '../util'; const TreeNode = Tree.TreeNode; describe('Tree util', () => { it('calc range keys', () => { const wrapper = mount( ); const { children } = wrapper.find(Tree).props(); const keys = calcRangeKeys(children, ['0-0', '0-2', '0-2-0'], '0-2-0-1', '0-0-0'); const target = ['0-0-0', '0-0-1', '0-1', '0-2', '0-2-0', '0-2-0-0', '0-2-0-1']; expect(keys.sort()).toEqual(target.sort()); }); });