mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
* [jest] disallow invalid describe calls (#41378) * [jest] disallow invalid describe calls * correct other describe calls * remove unnecessary glob * cast decribe names to strings * remove new async describe function # Conflicts: # .eslintrc.js # src/legacy/core_plugins/data/public/filter/filter_manager/filter_manager.test.ts # src/legacy/ui/public/courier/fetch/request/serialize_fetch_params/serialize_fetch_params.test.js # src/legacy/ui/public/kfetch/kfetch.test.ts # test/api_integration/apis/management/saved_objects/relationships.js # test/functional/apps/dashboard/create_and_add_embeddables.js # test/functional/apps/dashboard/dashboard_filter_bar.js # test/functional/apps/dashboard/dashboard_filtering.js # test/functional/apps/dashboard/dashboard_listing.js # test/functional/apps/dashboard/dashboard_options.js # test/functional/apps/dashboard/dashboard_query_bar.js # test/functional/apps/dashboard/dashboard_time.js # test/functional/apps/dashboard/embed_mode.js # test/functional/apps/dashboard/empty_dashboard.js # test/functional/apps/dashboard/full_screen_mode.js # test/functional/apps/dashboard/view_edit.js # test/functional/apps/discover/_discover.js # test/functional/apps/visualize/_point_series_options.js # test/functional/apps/visualize/_visualize_listing.js # x-pack/legacy/plugins/canvas/migrations.test.js # x-pack/legacy/plugins/canvas/server/routes/workpad.test.js # x-pack/legacy/plugins/cross_cluster_replication/__jest__/client_integration/auto_follow_pattern_list.test.js # x-pack/legacy/plugins/cross_cluster_replication/__jest__/client_integration/follower_indices_list.test.js # x-pack/legacy/plugins/grokdebugger/server/lib/license_pre_routing_factory/__tests__/license_pre_routing_factory.js # x-pack/legacy/plugins/index_management/__jest__/client_integration/home.test.ts # x-pack/legacy/plugins/maps/public/connected_components/map/feature_properties.test.js # x-pack/legacy/plugins/maps/public/connected_components/map/feature_tooltip.test.js # x-pack/legacy/plugins/monitoring/server/lib/elasticsearch_settings/__tests__/find_reason.js # x-pack/legacy/plugins/remote_clusters/__jest__/client_integration/remote_clusters_list.test.js # x-pack/legacy/plugins/reporting/export_types/csv/server/__tests__/execute_job.js # x-pack/legacy/plugins/reporting/server/routes/jobs.test.js # x-pack/legacy/plugins/reporting/server/usage/get_reporting_usage_collector.test.js # x-pack/legacy/plugins/security/server/lib/authorization/privileges/privileges.test.ts # x-pack/legacy/plugins/siem/public/components/last_event_time/index.test.tsx # x-pack/legacy/plugins/siem/public/components/page/add_to_kql/index.test.tsx # x-pack/legacy/plugins/siem/public/components/page/hosts/first_last_seen_host/index.test.tsx # x-pack/test/api_integration/apis/management/index_lifecycle_management/nodes.js # x-pack/test/api_integration/apis/security/roles.js # x-pack/test/functional/apps/canvas/smoke_test.js # x-pack/test/functional/apps/discover/feature_controls/discover_spaces.ts # x-pack/test/functional/apps/maps/documents_source/top_hits.js # x-pack/test/functional/apps/maps/es_geo_grid_source.js # x-pack/test/functional/apps/rollup_job/rollup_jobs.js # x-pack/test/functional/apps/spaces/spaces_selection.ts # x-pack/test/functional/apps/uptime/monitor.ts # x-pack/test_utils/jest/integration_tests/example_integration.test.ts * fix eslint violations
This commit is contained in:
parent
a65faaf2b5
commit
ec50f86b0c
26 changed files with 51 additions and 41 deletions
10
.eslintrc.js
10
.eslintrc.js
|
@ -310,6 +310,16 @@ module.exports = {
|
|||
},
|
||||
},
|
||||
|
||||
/**
|
||||
* Jest specific rules
|
||||
*/
|
||||
{
|
||||
files: ['**/*.test.{js,ts,tsx}'],
|
||||
rules: {
|
||||
'jest/valid-describe': 'error',
|
||||
},
|
||||
},
|
||||
|
||||
/**
|
||||
* APM overrides
|
||||
*/
|
||||
|
|
|
@ -195,7 +195,7 @@ describe('#topologicallyBatchProjects', () => {
|
|||
expect(expectedBatches).toMatchSnapshot();
|
||||
});
|
||||
|
||||
describe('batchByWorkspace = true', async () => {
|
||||
describe('batchByWorkspace = true', () => {
|
||||
test('batches projects topologically based on their project dependencies and workspaces', async () => {
|
||||
const batches = topologicallyBatchProjects(projects, graph, { batchByWorkspace: true });
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ describe('KuiButton', () => {
|
|||
describe('Props', () => {
|
||||
describe('buttonType', () => {
|
||||
BUTTON_TYPES.forEach(buttonType => {
|
||||
describe(buttonType, () => {
|
||||
describe(`${buttonType}`, () => {
|
||||
test(`renders the ${buttonType} class`, () => {
|
||||
const $button = render(
|
||||
<KuiButton
|
||||
|
|
|
@ -42,7 +42,7 @@ describe('KuiButtonIcon', () => {
|
|||
describe('Props', () => {
|
||||
describe('type', () => {
|
||||
ICON_TYPES.forEach(type => {
|
||||
describe(type, () => {
|
||||
describe(`${type}`, () => {
|
||||
test(`renders the ${type} class`, () => {
|
||||
const $buttonIcon = render(<KuiButtonIcon type={type} />);
|
||||
expect($buttonIcon).toMatchSnapshot();
|
||||
|
|
|
@ -57,7 +57,7 @@ describe('KuiLinkButton', () => {
|
|||
describe('Props', () => {
|
||||
describe('buttonType', () => {
|
||||
BUTTON_TYPES.forEach(buttonType => {
|
||||
describe(buttonType, () => {
|
||||
describe(`${buttonType}`, () => {
|
||||
test(`renders the ${buttonType} class`, () => {
|
||||
const $button = render(
|
||||
<KuiLinkButton
|
||||
|
|
|
@ -55,7 +55,7 @@ describe('KuiSubmitButton', () => {
|
|||
describe('Props', () => {
|
||||
describe('buttonType', () => {
|
||||
BUTTON_TYPES.forEach(buttonType => {
|
||||
describe(buttonType, () => {
|
||||
describe(`${buttonType}`, () => {
|
||||
test(`renders the ${buttonType} class`, () => {
|
||||
const $button = render(<KuiSubmitButton buttonType={buttonType} />);
|
||||
expect($button).toMatchSnapshot();
|
||||
|
|
|
@ -31,7 +31,7 @@ describe('KuiCollapseButton', () => {
|
|||
describe('Props', () => {
|
||||
describe('direction', () => {
|
||||
DIRECTIONS.forEach(direction => {
|
||||
describe(direction, () => {
|
||||
describe(`${direction}`, () => {
|
||||
test(`renders the ${direction} class`, () => {
|
||||
const component = <KuiCollapseButton direction={direction} {...requiredProps}/>;
|
||||
expect(render(component)).toMatchSnapshot();
|
||||
|
|
|
@ -69,7 +69,7 @@ describe('plugins/elasticsearch', function () {
|
|||
return compact([basePath, path]).join('.');
|
||||
};
|
||||
|
||||
describe(getKey('ssl.verificationMode'), function () {
|
||||
describe(`${getKey('ssl.verificationMode')}`, function () {
|
||||
let settings;
|
||||
let sslSettings;
|
||||
|
||||
|
|
|
@ -115,7 +115,7 @@ describe('headers', () => {
|
|||
return JSON.parse(requestParts[0]);
|
||||
};
|
||||
|
||||
describe('search request preference', async () => {
|
||||
describe('search request preference', () => {
|
||||
test('should be set to sessionId when courier:setRequestPreference is "sessionId"', async () => {
|
||||
const config = {
|
||||
get: () => {
|
||||
|
|
|
@ -44,7 +44,7 @@ export default function ({ getService }) {
|
|||
indexPatterns: GENERIC_RESPONSE_SCHEMA,
|
||||
});
|
||||
|
||||
describe('searches', async () => {
|
||||
describe('searches', () => {
|
||||
it('should validate search response schema', async () => {
|
||||
await supertest
|
||||
.get(`/api/kibana/management/saved_objects/relationships/search/960372e0-3224-11e8-a572-ffca06da1357`)
|
||||
|
@ -83,7 +83,7 @@ export default function ({ getService }) {
|
|||
});
|
||||
});
|
||||
|
||||
describe('dashboards', async () => {
|
||||
describe('dashboards', () => {
|
||||
const DASHBOARD_RESPONSE_SCHEMA = Joi.object().keys({
|
||||
visualizations: GENERIC_RESPONSE_SCHEMA,
|
||||
});
|
||||
|
@ -126,7 +126,7 @@ export default function ({ getService }) {
|
|||
});
|
||||
});
|
||||
|
||||
describe('visualizations', async () => {
|
||||
describe('visualizations', () => {
|
||||
const VISUALIZATIONS_RESPONSE_SCHEMA = Joi.object().keys({
|
||||
dashboards: GENERIC_RESPONSE_SCHEMA,
|
||||
});
|
||||
|
@ -164,7 +164,7 @@ export default function ({ getService }) {
|
|||
});
|
||||
});
|
||||
|
||||
describe('index patterns', async () => {
|
||||
describe('index patterns', () => {
|
||||
const INDEX_PATTERN_RESPONSE_SCHEMA = Joi.object().keys({
|
||||
searches: GENERIC_RESPONSE_SCHEMA,
|
||||
visualizations: GENERIC_RESPONSE_SCHEMA,
|
||||
|
|
|
@ -29,7 +29,7 @@ export default function ({ getPageObjects, getService }) {
|
|||
<h3>Inline HTML that should not be rendered as html</h3>
|
||||
`;
|
||||
|
||||
describe('visualize app', async () => {
|
||||
describe('visualize app', () => {
|
||||
before(async function () {
|
||||
await PageObjects.visualize.navigateToNewVisualization();
|
||||
await PageObjects.visualize.clickMarkdownWidget();
|
||||
|
@ -37,7 +37,7 @@ export default function ({ getPageObjects, getService }) {
|
|||
await PageObjects.visualize.clickGo();
|
||||
});
|
||||
|
||||
describe('markdown vis', async () => {
|
||||
describe('markdown vis', () => {
|
||||
|
||||
it('should not have inspector enabled', async function () {
|
||||
await inspector.expectIsNotEnabled();
|
||||
|
|
|
@ -28,7 +28,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
const fromTime = '2015-09-19 06:31:44.000';
|
||||
const toTime = '2015-09-23 18:31:44.000';
|
||||
|
||||
describe('pie chart', async function () {
|
||||
describe('pie chart', function () {
|
||||
const vizName1 = 'Visualization PieChart';
|
||||
before(async function () {
|
||||
log.debug('navigateToApp visualize');
|
||||
|
|
|
@ -211,7 +211,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
|
||||
});
|
||||
|
||||
describe('Only request data around extent of map option', async () => {
|
||||
describe('Only request data around extent of map option', () => {
|
||||
|
||||
it('when checked adds filters to aggregation', async () => {
|
||||
const vizName1 = 'Visualization TileMap';
|
||||
|
|
|
@ -228,7 +228,7 @@ describe(`when job is completed`, () => {
|
|||
expect(headers['content-type']).toBe('application/pdf');
|
||||
});
|
||||
|
||||
describe(`when non-whitelisted contentType specified in job output`, async () => {
|
||||
describe(`when non-whitelisted contentType specified in job output`, () => {
|
||||
test(`sets statusCode to 500`, async () => {
|
||||
const { statusCode } = await getCompletedResponse({ outputContentType: 'application/html' });
|
||||
expect(statusCode).toBe(500);
|
||||
|
|
|
@ -70,7 +70,7 @@ test('sets enabled to false when reporting is turned off', async () => {
|
|||
expect(usageStats.enabled).toBe(false);
|
||||
});
|
||||
|
||||
describe('with a basic license', async () => {
|
||||
describe('with a basic license', () => {
|
||||
let usageStats;
|
||||
beforeAll(async () => {
|
||||
const serverWithBasicLicenseMock = getServerMock();
|
||||
|
@ -93,7 +93,7 @@ describe('with a basic license', async () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('with no license', async () => {
|
||||
describe('with no license', () => {
|
||||
let usageStats;
|
||||
beforeAll(async () => {
|
||||
const serverWithNoLicenseMock = getServerMock();
|
||||
|
@ -116,7 +116,7 @@ describe('with no license', async () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('with platinum license', async () => {
|
||||
describe('with platinum license', () => {
|
||||
let usageStats;
|
||||
beforeAll(async () => {
|
||||
const serverWithPlatinumLicenseMock = getServerMock();
|
||||
|
|
|
@ -21,7 +21,7 @@ describe('getDeprecationLoggingStatus', () => {
|
|||
});
|
||||
|
||||
describe('setDeprecationLogging', () => {
|
||||
describe('isEnabled = true', async () => {
|
||||
describe('isEnabled = true', () => {
|
||||
it('calls cluster.putSettings with logger.deprecation = WARN', async () => {
|
||||
const callWithRequest = jest.fn();
|
||||
await setDeprecationLogging(callWithRequest, {} as any, true);
|
||||
|
@ -31,7 +31,7 @@ describe('setDeprecationLogging', () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe('isEnabled = false', async () => {
|
||||
describe('isEnabled = false', () => {
|
||||
it('calls cluster.putSettings with logger.deprecation = ERROR', async () => {
|
||||
const callWithRequest = jest.fn();
|
||||
await setDeprecationLogging(callWithRequest, {} as any, false);
|
||||
|
|
|
@ -74,7 +74,7 @@ export default function ({ getService }) {
|
|||
});
|
||||
});
|
||||
|
||||
it(`should ${basic ? 'not' : ''} create a role with kibana and FLS/DLS elasticsearch
|
||||
it(`should ${basic ? 'not' : ''} create a role with kibana and FLS/DLS elasticsearch
|
||||
privileges on ${basic ? 'basic' : 'trial'} licenses`, async () => {
|
||||
await supertest.put('/api/security/role/role_with_privileges_dls_fls')
|
||||
.set('kbn-xsrf', 'xxx')
|
||||
|
@ -191,7 +191,7 @@ export default function ({ getService }) {
|
|||
});
|
||||
});
|
||||
|
||||
it(`should ${basic ? 'not' : ''} update a role adding DLS and TLS priviledges
|
||||
it(`should ${basic ? 'not' : ''} update a role adding DLS and TLS priviledges
|
||||
when using ${basic ? 'basic' : 'trial'} license`, async () => {
|
||||
|
||||
await es.shield.putRole({
|
||||
|
|
|
@ -15,7 +15,7 @@ export default function canvasSmokeTest({ getService, getPageObjects }) {
|
|||
const log = getService('log');
|
||||
const PageObjects = getPageObjects(['common']);
|
||||
|
||||
describe('smoke test', async () => {
|
||||
describe('smoke test', () => {
|
||||
const workpadListSelector = 'canvasWorkpadLoaderTable canvasWorkpadLoaderWorkpad';
|
||||
const testWorkpadId = 'workpad-1705f884-6224-47de-ba49-ca224fe6ec31';
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ export default function ({ getPageObjects, getService }) {
|
|||
|
||||
function makeRequestTestsForGeoPrecision(LAYER_ID) {
|
||||
|
||||
describe('geoprecision - requests', async () => {
|
||||
describe('geoprecision - requests', () => {
|
||||
let beforeTimestamp;
|
||||
beforeEach(async () => {
|
||||
await PageObjects.maps.setView(DATA_CENTER_LAT, DATA_CENTER_LON, 1);
|
||||
|
@ -48,7 +48,7 @@ export default function ({ getPageObjects, getService }) {
|
|||
});
|
||||
});
|
||||
|
||||
describe('geoprecision - data', async ()=> {
|
||||
describe('geoprecision - data', ()=> {
|
||||
|
||||
beforeEach(async () => {
|
||||
await PageObjects.maps.setView(DATA_CENTER_LAT, DATA_CENTER_LON, 1);
|
||||
|
|
|
@ -16,7 +16,7 @@ export default function ({ getPageObjects }) {
|
|||
await PageObjects.maps.loadSavedMap('layer with errors');
|
||||
});
|
||||
|
||||
describe('ESSearchSource with missing index pattern id', async () => {
|
||||
describe('ESSearchSource with missing index pattern id', () => {
|
||||
const MISSING_INDEX_ID = 'idThatDoesNotExitForESSearchSource';
|
||||
const LAYER_NAME = MISSING_INDEX_ID;
|
||||
|
||||
|
@ -33,7 +33,7 @@ export default function ({ getPageObjects }) {
|
|||
});
|
||||
});
|
||||
|
||||
describe('ESGeoGridSource with missing index pattern id', async () => {
|
||||
describe('ESGeoGridSource with missing index pattern id', () => {
|
||||
const MISSING_INDEX_ID = 'idThatDoesNotExitForESGeoGridSource';
|
||||
const LAYER_NAME = MISSING_INDEX_ID;
|
||||
|
||||
|
@ -49,7 +49,7 @@ export default function ({ getPageObjects }) {
|
|||
});
|
||||
});
|
||||
|
||||
describe('ESJoinSource with missing index pattern id', async () => {
|
||||
describe('ESJoinSource with missing index pattern id', () => {
|
||||
const MISSING_INDEX_ID = 'idThatDoesNotExitForESJoinSource';
|
||||
const LAYER_NAME = 'geo_shapes*';
|
||||
|
||||
|
@ -65,7 +65,7 @@ export default function ({ getPageObjects }) {
|
|||
});
|
||||
});
|
||||
|
||||
describe('EMSFileSource with missing EMS id', async () => {
|
||||
describe('EMSFileSource with missing EMS id', () => {
|
||||
const MISSING_EMS_ID = 'idThatDoesNotExitForEMSFileSource';
|
||||
const LAYER_NAME = 'EMS_vector_shapes';
|
||||
|
||||
|
@ -81,7 +81,7 @@ export default function ({ getPageObjects }) {
|
|||
});
|
||||
});
|
||||
|
||||
describe('EMSTMSSource with missing EMS id', async () => {
|
||||
describe('EMSTMSSource with missing EMS id', () => {
|
||||
const MISSING_EMS_ID = 'idThatDoesNotExitForEMSTile';
|
||||
const LAYER_NAME = 'EMS_tiles';
|
||||
|
||||
|
@ -97,7 +97,7 @@ export default function ({ getPageObjects }) {
|
|||
});
|
||||
});
|
||||
|
||||
describe('KibanaRegionmapSource with missing region map configuration', async () => {
|
||||
describe('KibanaRegionmapSource with missing region map configuration', () => {
|
||||
const MISSING_REGION_NAME = 'nameThatDoesNotExitForKibanaRegionmapSource';
|
||||
const LAYER_NAME = 'Custom_vector_shapes';
|
||||
|
||||
|
@ -113,7 +113,7 @@ export default function ({ getPageObjects }) {
|
|||
});
|
||||
});
|
||||
|
||||
describe('KibanaTilemapSource with missing map.tilemap.url configuration', async () => {
|
||||
describe('KibanaTilemapSource with missing map.tilemap.url configuration', () => {
|
||||
const LAYER_NAME = 'Custom_TMS';
|
||||
|
||||
it('should diplay error message in layer panel', async () => {
|
||||
|
|
|
@ -157,7 +157,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
});
|
||||
});
|
||||
|
||||
describe('alert actions take you to the elasticsearch indices listing', async () => {
|
||||
describe('alert actions take you to the elasticsearch indices listing', () => {
|
||||
const { setup, tearDown } = getLifecycleMethods(getService, getPageObjects);
|
||||
|
||||
before(async () => {
|
||||
|
|
|
@ -12,7 +12,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
const log = getService('log');
|
||||
const PageObjects = getPageObjects(['security', 'rollup', 'common', 'header']);
|
||||
|
||||
describe('rollup job', async () => {
|
||||
describe('rollup job', () => {
|
||||
before(async () => {
|
||||
// init data
|
||||
await Promise.all([
|
||||
|
|
|
@ -38,8 +38,8 @@ export default function ({ getService, getPageObjects }) {
|
|||
await PageObjects.settings.navigateTo();
|
||||
});
|
||||
|
||||
describe('Security', async () => {
|
||||
describe('navigation', async () => {
|
||||
describe('Security', () => {
|
||||
describe('navigation', () => {
|
||||
it('Can navigate to create user section', async () => {
|
||||
await PageObjects.security.clickElasticsearchUsers();
|
||||
await PageObjects.security.clickCreateNewUser();
|
||||
|
|
|
@ -14,7 +14,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
const browser = getService('browser');
|
||||
const kibanaServer = getService('kibanaServer');
|
||||
|
||||
describe('rbac ', async function () {
|
||||
describe('rbac ', function () {
|
||||
before(async () => {
|
||||
await browser.setWindowSize(1600, 1000);
|
||||
log.debug('users');
|
||||
|
|
|
@ -20,7 +20,7 @@ export default function ({ getService }) {
|
|||
const reportingAPI = getService('reportingAPI');
|
||||
const usageAPI = getService('usageAPI');
|
||||
|
||||
describe('BWC report generation into existing indexes', async () => {
|
||||
describe('BWC report generation into existing indexes', () => {
|
||||
let expectedCompletedReportCount;
|
||||
let cleanupIndexAlias;
|
||||
|
||||
|
|
|
@ -174,7 +174,7 @@ export function deleteTestSuiteFactory(es: any, esArchiver: any, supertest: Supe
|
|||
.then(tests.exists.response);
|
||||
});
|
||||
|
||||
describe(`when the space is reserved`, async () => {
|
||||
describe(`when the space is reserved`, () => {
|
||||
it(`should return ${tests.reservedSpace.statusCode}`, async () => {
|
||||
return supertest
|
||||
.delete(`${getUrlPrefix(spaceId)}/api/spaces/space/default`)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue