3 * Copyright (C) 2009-2017 SonarSource SA
4 * mailto:info AT sonarsource DOT com
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 3 of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
20 import React from 'react';
21 import { shallow } from 'enzyme';
22 import ProjectActivityGraphs from '../ProjectActivityGraphs';
27 date: '2016-10-27T16:33:50+0200',
38 date: '2016-10-27T12:21:15+0200',
43 date: '2016-10-26T12:17:29+0200',
59 const DEFAULT_PROPS = {
61 leakPeriodDate: '2017-05-16T13:50:02+0200',
65 metric: 'code_smells',
67 { date: new Date('2016-10-26T12:17:29+0200'), value: '2286' },
68 { date: new Date('2016-10-27T12:21:15+0200'), value: '1749' },
69 { date: new Date('2016-10-27T16:33:50+0200'), value: '500' }
74 project: 'org.sonarsource.sonarqube:sonarqube',
75 query: { category: '', graph: 'overview', project: 'org.sonarsource.sonarqube:sonarqube' },
79 it('should render correctly the graph and legends', () => {
80 expect(shallow(<ProjectActivityGraphs {...DEFAULT_PROPS} />)).toMatchSnapshot();
83 it('should render correctly filter history on dates', () => {
84 const wrapper = shallow(
85 <ProjectActivityGraphs
87 query={{ ...DEFAULT_PROPS.query, from: '2016-10-27T12:21:15+0200' }}
90 expect(wrapper.state()).toMatchSnapshot();