kibana/x-pack/plugins/rollup/fixtures/job.js
Tyler Smalley 8c2976d847
Consolidates Jest configuration files and scripts (#82671) (#83362)
Jest tests are currently organized into main configuration files (src/dev/jest/config.js and x-pack/dev-tools/jest/create_jest_config.js). Both of these are similar, but very slightly due to  previously being in separate repositories. This change consolidates the scripts referenced in those configs and moves them to the `@kbn/test` project.

OSS contained an alias for `test_utils`. Those aliases have been removed in favor of importing these utilities from `@kbn/test/jest`

Blocker to #72569

Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-11-13 13:25:06 -08:00

52 lines
1.3 KiB
JavaScript

/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import { getRandomString } from '@kbn/test/jest';
const initialValues = {
dateHistogramField: 'timestamp',
dateHistogramInterval: '24h',
dateHistogramTimeZone: 'UTC',
documentsProcessed: 10,
histogram: [{ name: 'DistanceMiles' }, { name: 'FlightTimeMin' }],
id: 'test',
indexPattern: 'kibana*',
json: {
foo: 'bar',
},
metrics: [
{
name: 'dayOfWeek',
types: ['avg', 'max', 'min'],
},
{
name: 'distanceKilometers',
types: ['avg', 'max'],
},
],
pagesProcessed: 3,
rollupCron: '0 0 0 ? * 7',
rollupDelay: '1d',
rollupIndex: 'my_rollup_index',
rollupsIndexed: 2,
status: 'stopped',
terms: [{ name: 'Dest' }, { name: 'Carrier' }, { name: 'DestCountry' }],
triggerCount: 7,
};
const statuses = [
'stopped',
'stopping',
'started',
'indexing',
'abort',
'abc' /* unknown status */,
];
export const getJob = (values = { id: getRandomString() }) => ({ ...initialValues, ...values });
export const jobCount = statuses.length;
export const getJobs = () => statuses.map((status) => getJob({ status, id: getRandomString() }));