-
Notifications
You must be signed in to change notification settings - Fork 981
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
373 additions
and
790 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,7 +59,6 @@ module.exports = [ | |
/** | ||
* Other packages | ||
*/ | ||
'c3', | ||
'diff', | ||
'ipaddr.js', | ||
'jstz', | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 0 additions & 58 deletions
58
webpack/assets/javascripts/react_app/components/common/charts/Chart.js
This file was deleted.
Oops, something went wrong.
153 changes: 0 additions & 153 deletions
153
webpack/assets/javascripts/react_app/components/common/charts/Chart.test.js
This file was deleted.
Oops, something went wrong.
47 changes: 47 additions & 0 deletions
47
...k/assets/javascripts/react_app/components/common/charts/DonutChart/DonutChart.fixtures.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
export default [['column1', 100], ['column2', 50]]; | ||
|
||
export const mockStoryData = { | ||
donut: { | ||
width: 15, | ||
label: { | ||
show: false, | ||
}, | ||
}, | ||
data: { | ||
columns: [['Fedora 21', 3], ['Ubuntu 14.04', 4], ['Centos 7', 2], ['Debian 8', 1]], | ||
names: { | ||
'Fedora 21': 'Fedora 21', | ||
'Ubuntu 14.04': 'Ubuntu 14.04', | ||
'Centos 7': 'Centos 7', | ||
'Debian 8': 'Debian 8', | ||
}, | ||
}, | ||
tooltip: { | ||
show: true, | ||
}, | ||
legend: { | ||
show: false, | ||
}, | ||
padding: { | ||
top: 0, | ||
left: 0, | ||
right: 0, | ||
bottom: 0, | ||
}, | ||
noDataMsg: 'No data available', | ||
tip: 'Expand the chart', | ||
status: 'RESOLVED', | ||
id: 'operatingsystem', | ||
title: 'OS Distribution', | ||
search: '/hosts?search=os_title=~VAL~', | ||
}; | ||
|
||
export const emptyData = { | ||
data: { | ||
type: 'donut', | ||
columns: [], | ||
names: { | ||
}, | ||
}, | ||
noDataMsg: 'No data available', | ||
}; |
22 changes: 22 additions & 0 deletions
22
webpack/assets/javascripts/react_app/components/common/charts/DonutChart/DonutChart.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { shallow } from 'enzyme'; | ||
import toJson from 'enzyme-to-json'; | ||
import React from 'react'; | ||
import { mockStoryData, emptyData } from './DonutChart.fixtures'; | ||
import DonutChart from './'; | ||
import * as chartService from '../../../../../services/ChartService'; | ||
|
||
jest.unmock('./'); | ||
describe('renders DonutChart', () => { | ||
it('render donut chart', () => { | ||
chartService.getDonutChartConfig = jest.fn(() => mockStoryData); | ||
const wrapper = shallow(<DonutChart data={mockStoryData} />); | ||
|
||
expect(toJson(wrapper)).toMatchSnapshot(); | ||
}); | ||
it('render empty state', () => { | ||
chartService.getDonutChartConfig = jest.fn(() => emptyData); | ||
const wrapper = shallow(<DonutChart data={emptyData} />); | ||
|
||
expect(toJson(wrapper)).toMatchSnapshot(); | ||
}); | ||
}); |
Oops, something went wrong.