Skip to content

Commit

Permalink
[Rollup] Unit test for detail panel (elastic#31690)
Browse files Browse the repository at this point in the history
  • Loading branch information
sebelga committed Feb 26, 2019
1 parent 791042e commit 8ccb366
Show file tree
Hide file tree
Showing 8 changed files with 564 additions and 185 deletions.
2 changes: 1 addition & 1 deletion x-pack/plugins/rollup/__jest__/utils/testbed.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Provider } from 'react-redux';
import { mountWithIntl } from 'test_utils/enzyme_helpers'; // eslint-disable-line import/no-unresolved
import { findTestSubject as findTestSubjectHelper } from '@elastic/eui/lib/test';

const registerTestSubjExists = component => testSubject => Boolean(findTestSubjectHelper(component, testSubject).length);
const registerTestSubjExists = component => (testSubject, count = 1) => findTestSubjectHelper(component, testSubject).length === count;

export const registerTestBed = (Component, defaultProps, store = {}) => (props) => {
const component = mountWithIntl(
Expand Down
14 changes: 9 additions & 5 deletions x-pack/plugins/rollup/fixtures/job.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,38 @@ const initialValues = {
dateHistogramField: 'timestamp',
dateHistogramInterval: '24h',
dateHistogramTimeZone: 'UTC',
documentsProcessed: 0,
documentsProcessed: 10,
histogram: [
{ name: 'DistanceMiles' },
{ name: 'FlightTimeMin' },
],
id: 'test',
indexPattern: 'kibana*',
json: {
foo: 'bar',
},
metrics: [
{
name: 'dayOfWeek',
types: ['avg', 'min']
types: ['avg', 'max', 'min']
},
{
name: 'distanceKilometers',
types: ['avg', 'max']
}
],
pagesProcessed: 0,
pagesProcessed: 3,
rollupCron: '0 0 0 ? * 7',
rollupDelay: '1d',
rollupIndex: 'my_rollup_index',
rollupsIndexed: 0,
rollupsIndexed: 2,
status: 'stopped',
terms: [
{ name: 'Dest' },
{ name: 'Carrier' },
{ name: 'DestCountry' },
],
triggerCount: 0,
triggerCount: 7,
};

export const getJob = (values = { id: getRandomString() }) => ({ ...initialValues, ...values });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

import React, { Fragment } from 'react';
import React from 'react';
import PropTypes from 'prop-types';

import {
Expand Down Expand Up @@ -64,17 +64,15 @@ export const FieldList = ({
};

return (
<Fragment>
<EuiInMemoryTable
items={fields}
itemId="name"
columns={extendedColumns}
search={search}
pagination={pagination}
sorting={true}
message={message}
/>
</Fragment>
<EuiInMemoryTable
items={fields}
itemId="name"
columns={extendedColumns}
search={search}
pagination={pagination}
sorting={true}
message={message}
/>
);
};

Expand Down
Loading

0 comments on commit 8ccb366

Please sign in to comment.