Skip to content

Commit

Permalink
Run prettier on edited files.
Browse files Browse the repository at this point in the history
  • Loading branch information
justinkambic committed Jul 8, 2018
1 parent 38d6ee5 commit 5c7a413
Show file tree
Hide file tree
Showing 10 changed files with 123 additions and 224 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,14 @@ describe('CollapsibleStatement component', () => {
const child = <div>child element</div>;

const wrapper = shallow(
<CollapsibleStatement {...props}>
{child}
</CollapsibleStatement>
<CollapsibleStatement {...props}>{child}</CollapsibleStatement>
);

expect(wrapper).toMatchSnapshot();
});

it('calls collapse if component is expanded', () => {
const wrapper = shallow(
<CollapsibleStatement {...props} />
);
const wrapper = shallow(<CollapsibleStatement {...props} />);

wrapper.find(EuiButtonIcon).simulate('click');
expect(collapse).toHaveBeenCalledTimes(1);
Expand All @@ -49,9 +45,7 @@ describe('CollapsibleStatement component', () => {

it('calls expand if component is collapsed', () => {
props.isCollapsed = true;
const wrapper = shallow(
<CollapsibleStatement {...props} />
);
const wrapper = shallow(<CollapsibleStatement {...props} />);

wrapper.find(EuiButtonIcon).simulate('click');
expect(expand).toHaveBeenCalledTimes(1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,10 @@ describe('DetailDrawer component', () => {

test('shows vertex title', () => {
const vertex = {
title: 'grok'
title: 'grok',
};

const component = (
<DetailDrawer
vertex={vertex}
onHide={onHide}
/>
);
const component = <DetailDrawer vertex={vertex} onHide={onHide} />;
const renderedComponent = shallow(component);
expect(renderedComponent).toMatchSnapshot();
});
Expand All @@ -43,46 +38,34 @@ describe('DetailDrawer component', () => {
id: 'parse_apache_logline',
stats: {
events_in: {
data: [
[ 1516131120000, 200 ],
[ 1516131180000, 203 ]
],
data: [[1516131120000, 200], [1516131180000, 203]],
timeRange: {
min: 1516131138639,
max: 1516135440463
}
max: 1516135440463,
},
},
events_out: {
data: [
[ 1516131120000, 199 ],
[ 1516131180000, 200 ]
],
data: [[1516131120000, 199], [1516131180000, 200]],
timeRange: {
min: 1516131138639,
max: 1516135440463
}
max: 1516135440463,
},
},
millis_per_event: {
data: [
[ 1516131120000, 0.21 ],
[ 1516131180000, 0.23 ]
],
data: [[1516131120000, 0.21], [1516131180000, 0.23]],
timeRange: {
min: 1516131138639,
max: 1516135440463
}
}
max: 1516135440463,
},
},
},
eventsPerSecond: {
data: [
[ 1516131120000, 32 ],
[ 1516131180000, 36 ]
],
data: [[1516131120000, 32], [1516131180000, 36]],
timeRange: {
min: 1516131138639,
max: 1516135440463
}
}
max: 1516135440463,
},
},
};

const component = (
Expand All @@ -107,46 +90,34 @@ describe('DetailDrawer component', () => {
id: 'foobarbazqux',
stats: {
events_in: {
data: [
[ 1516131120000, 200 ],
[ 1516131180000, 203 ]
],
data: [[1516131120000, 200], [1516131180000, 203]],
timeRange: {
min: 1516131138639,
max: 1516135440463
}
max: 1516135440463,
},
},
events_out: {
data: [
[ 1516131120000, 199 ],
[ 1516131180000, 200 ]
],
data: [[1516131120000, 199], [1516131180000, 200]],
timeRange: {
min: 1516131138639,
max: 1516135440463
}
max: 1516135440463,
},
},
millis_per_event: {
data: [
[ 1516131120000, 0.21 ],
[ 1516131180000, 0.23 ]
],
data: [[1516131120000, 0.21], [1516131180000, 0.23]],
timeRange: {
min: 1516131138639,
max: 1516135440463
}
}
max: 1516135440463,
},
},
},
eventsPerSecond: {
data: [
[ 1516131120000, 32 ],
[ 1516131180000, 36 ]
],
data: [[1516131120000, 32], [1516131180000, 36]],
timeRange: {
min: 1516131138639,
max: 1516135440463
}
}
max: 1516135440463,
},
},
};

const component = (
Expand All @@ -167,7 +138,7 @@ describe('DetailDrawer component', () => {
const vertex = {
title: 'if',
typeString: 'if',
subtitle: '[type] == "apache_log"'
subtitle: '[type] == "apache_log"',
};

const component = (
Expand All @@ -186,7 +157,7 @@ describe('DetailDrawer component', () => {
test('shows basic info and no stats for queue', () => {
const vertex = {
title: 'queue',
typeString: 'queue'
typeString: 'queue',
};

const component = (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,29 +15,20 @@ describe('Metric component', () => {
metric = {
className: 'metricClass',
warning: true,
value: '220'
value: '220',
};
});

it('renders warning badge', () => {
const wrapper = shallow(
<Metric
{...metric}
/>
);
const wrapper = shallow(<Metric {...metric} />);

expect(wrapper).toMatchSnapshot();
});

it('does not render warning badge when no warning present', () => {
metric.warning = false;
const wrapper = shallow(
<Metric
{...metric}
/>
);
const wrapper = shallow(<Metric {...metric} />);

expect(wrapper).toMatchSnapshot();
});

});
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ import React from 'react';
import { PluginStatement } from '../plugin_statement';
import { shallow } from 'enzyme';

import {
EuiButtonEmpty,
EuiBadge,
} from '@elastic/eui';
import { EuiButtonEmpty, EuiBadge } from '@elastic/eui';

describe('PluginStatement component', () => {
let props;
Expand Down Expand Up @@ -48,7 +45,7 @@ describe('PluginStatement component', () => {
percentOfTotalProcessorTime: 25,
isSlow,
isTimeConsuming,
}
},
};
});

Expand All @@ -73,7 +70,9 @@ describe('PluginStatement component', () => {

it('adds warning highlight for cpu time', () => {
props.statement = processorStatement;
props.statement.vertex.isTimeConsuming = jest.fn().mockImplementation(() => true);
props.statement.vertex.isTimeConsuming = jest
.fn()
.mockImplementation(() => true);
expect(render(props)).toMatchSnapshot();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,14 @@
import React from 'react';
import PropTypes from 'prop-types';

import {
EuiButtonIcon,
EuiFlexGroup,
EuiFlexItem
} from '@elastic/eui';
import { EuiButtonIcon, EuiFlexGroup, EuiFlexItem } from '@elastic/eui';

function getToggleIconType(isCollapsed) {
return isCollapsed ? 'arrowRight' : 'arrowDown';
}

export function CollapsibleStatement(props) {
const {
collapse,
expand,
id,
isCollapsed
} = props;
const { collapse, expand, id, isCollapsed } = props;

const toggleClicked = () => {
if (isCollapsed) {
Expand All @@ -40,10 +31,7 @@ export function CollapsibleStatement(props) {
alignItems="center"
className="pipelineViewer__statement"
>
<EuiFlexItem
key={id}
grow={false}
>
<EuiFlexItem key={id} grow={false}>
<EuiButtonIcon
aria-label
color="text"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,11 @@

import React from 'react';
import PropTypes from 'prop-types';
import {
EuiFlexItem,
EuiBadge,
EuiText,
} from '@elastic/eui';
import { EuiFlexItem, EuiBadge, EuiText } from '@elastic/eui';
import classNames from 'classnames';

export function Metric({ className, warning, value }) {

const classes = classNames(
'pipelineViewer__metric',
className,
);
const classes = classNames('pipelineViewer__metric', className);

let stylizedValue;
if (warning) {
Expand All @@ -30,17 +22,12 @@ export function Metric({ className, warning, value }) {
} else {
stylizedValue = (
<EuiText size="s" color="subdued" className={classes}>
<span>
{value}
</span>
<span>{value}</span>
</EuiText>
);
}
return (
<EuiFlexItem
className="pipelineViewer__metricFlexItem"
grow={false}
>
<EuiFlexItem className="pipelineViewer__metricFlexItem" grow={false}>
{stylizedValue}
</EuiFlexItem>
);
Expand Down
Loading

0 comments on commit 5c7a413

Please sign in to comment.