1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import * as React from 'react';
6 import * as ReactDOM from 'react-dom';
7 import { shallow, mount, render } from 'enzyme';
8 import * as Enzyme from 'enzyme';
9 import * as Adapter from 'enzyme-adapter-react-16';
10 import ListItemIcon from '@material-ui/core/ListItemIcon';
11 import { Collapse } from '@material-ui/core';
13 import ProjectTree from './project-tree';
14 import { TreeItem } from '../tree/tree';
15 import { Project } from '../../models/project';
16 Enzyme.configure({ adapter: new Adapter() });
18 describe("ProjectTree component", () => {
20 it("checks is there ListItemIcon in the ProjectTree component", () => {
21 const project: TreeItem<Project> = {
24 createdAt: "2018-06-12",
25 icon: <i className="fas fa-th" />
31 const wrapper = mount(<ProjectTree projects={[project]} toggleProjectTreeItem={() => { }} />);
33 expect(wrapper.find(ListItemIcon).length).toEqual(1);
36 it("checks are there two ListItemIcon's in the ProjectTree component", () => {
37 const project: Array<TreeItem<Project>> = [
41 createdAt: "2018-06-12",
42 icon: <i className="fas fa-th" />
51 createdAt: "2018-06-12",
52 icon: <i className="fas fa-th" />
59 const wrapper = mount(<ProjectTree projects={project} toggleProjectTreeItem={() => { }} />);
61 expect(wrapper.find(ListItemIcon).length).toEqual(2);
64 it("check ProjectTree, when open is changed", () => {
65 const project: TreeItem<Project> = {
68 createdAt: "2018-06-12",
69 icon: <i className="fas fa-th" />
78 createdAt: "2018-06-12",
79 icon: <i className="fas fa-th" />
87 const wrapper = mount(<ProjectTree projects={[project]} toggleProjectTreeItem={() => { }} />);
88 wrapper.setState({open: true });
90 expect(wrapper.find(Collapse).length).toEqual(1);