Skip to content

Commit

Permalink
chore(NA): remove lodash 3 types from src and move test to lodash4
Browse files Browse the repository at this point in the history
  • Loading branch information
mistic committed Jun 24, 2020
1 parent 92ec97e commit bf18a6c
Show file tree
Hide file tree
Showing 12 changed files with 18 additions and 58 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import expect from '@kbn/expect';
import { sortBy } from 'lodash';
import { sortBy } from 'lodash4';

export default function ({ getService }) {
const esArchiver = getService('esArchiver');
Expand Down
2 changes: 1 addition & 1 deletion test/api_integration/apis/kql_telemetry/kql_telemetry.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import expect from '@kbn/expect';
import Bluebird from 'bluebird';
import { get } from 'lodash';
import { get } from 'lodash4';

export default function ({ getService }) {
const supertest = getService('supertest');
Expand Down
2 changes: 1 addition & 1 deletion test/api_integration/apis/saved_objects/bulk_update.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import expect from '@kbn/expect';
import _ from 'lodash';
import _ from 'lodash4';

export default function ({ getService }) {
const supertest = getService('supertest');
Expand Down
4 changes: 2 additions & 2 deletions test/api_integration/apis/saved_objects/migrations.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
* Smokescreen tests for core migration logic
*/

import _ from 'lodash';
import _ from 'lodash4';
import { assert } from 'chai';
import {
DocumentMigrator,
Expand Down Expand Up @@ -293,7 +293,7 @@ export default ({ getService }) => {

// It only created the original and the dest
assert.deepEqual(
_.pluck(
_.map(
await callCluster('cat.indices', { index: '.migration-c*', format: 'json' }),
'index'
).sort(),
Expand Down
2 changes: 1 addition & 1 deletion test/api_integration/apis/telemetry/telemetry_local.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import expect from '@kbn/expect';
import _ from 'lodash';
import _ from 'lodash4';

/*
* Create a single-level array with strings for all the paths to values in the
Expand Down
29 changes: 7 additions & 22 deletions test/functional/apps/management/_import_objects.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import expect from '@kbn/expect';
import path from 'path';
import { indexBy } from 'lodash';
import { keyBy } from 'lodash4';

export default function ({ getService, getPageObjects }) {
const kibanaServer = getService('kibanaServer');
Expand Down Expand Up @@ -50,15 +50,12 @@ export default function ({ getService, getPageObjects }) {
await PageObjects.settings.clickImportDone();

// get all the elements in the table, and index them by the 'title' visible text field
const elements = indexBy(
await PageObjects.settings.getSavedObjectElementsInTable(),
'title'
);
const elements = keyBy(await PageObjects.settings.getSavedObjectElementsInTable(), 'title');
log.debug("check that 'Log Agents' is in table as a visualization");
expect(elements['Log Agents'].objectType).to.eql('visualization');

await elements['logstash-*'].relationshipsElement.click();
const flyout = indexBy(await PageObjects.settings.getRelationshipFlyout(), 'title');
const flyout = keyBy(await PageObjects.settings.getRelationshipFlyout(), 'title');
log.debug(
"check that 'Shared-Item Visualization AreaChart' shows 'logstash-*' as it's Parent"
);
Expand Down Expand Up @@ -153,10 +150,7 @@ export default function ({ getService, getPageObjects }) {
});

it('should not import saved objects linked to saved searches when saved search index pattern does not exist', async function () {
const elements = indexBy(
await PageObjects.settings.getSavedObjectElementsInTable(),
'title'
);
const elements = keyBy(await PageObjects.settings.getSavedObjectElementsInTable(), 'title');
await elements['logstash-*'].checkbox.click();
await PageObjects.settings.clickSavedObjectsDelete();

Expand Down Expand Up @@ -188,10 +182,7 @@ export default function ({ getService, getPageObjects }) {

it('should import saved objects with index patterns when index patterns does not exists', async () => {
// First, we need to delete the index pattern
const elements = indexBy(
await PageObjects.settings.getSavedObjectElementsInTable(),
'title'
);
const elements = keyBy(await PageObjects.settings.getSavedObjectElementsInTable(), 'title');
await elements['logstash-*'].checkbox.click();
await PageObjects.settings.clickSavedObjectsDelete();

Expand Down Expand Up @@ -330,10 +321,7 @@ export default function ({ getService, getPageObjects }) {
await PageObjects.settings.clickImportDone();

// Second, we need to delete the index pattern
const elements = indexBy(
await PageObjects.settings.getSavedObjectElementsInTable(),
'title'
);
const elements = keyBy(await PageObjects.settings.getSavedObjectElementsInTable(), 'title');
await elements['logstash-*'].checkbox.click();
await PageObjects.settings.clickSavedObjectsDelete();

Expand Down Expand Up @@ -365,10 +353,7 @@ export default function ({ getService, getPageObjects }) {

it('should import saved objects with index patterns when index patterns does not exists', async () => {
// First, we need to delete the index pattern
const elements = indexBy(
await PageObjects.settings.getSavedObjectElementsInTable(),
'title'
);
const elements = keyBy(await PageObjects.settings.getSavedObjectElementsInTable(), 'title');
await elements['logstash-*'].checkbox.click();
await PageObjects.settings.clickSavedObjectsDelete();

Expand Down
2 changes: 1 addition & 1 deletion test/functional/apps/visualize/_chart_types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

import _ from 'lodash';
import _ from 'lodash4';
import expect from '@kbn/expect';
import { FtrProviderContext } from '../../ftr_provider_context';

Expand Down
2 changes: 1 addition & 1 deletion test/functional/page_objects/common_page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

import { delay } from 'bluebird';
import expect from '@kbn/expect';
import { get } from 'lodash';
import { get } from 'lodash4';
// @ts-ignore
import fetch from 'node-fetch';
import { FtrProviderContext } from '../ftr_provider_context';
Expand Down
6 changes: 3 additions & 3 deletions test/functional/services/common/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

import { cloneDeep } from 'lodash';
import { cloneDeepWith } from 'lodash4';
import { Key, Origin } from 'selenium-webdriver';
// @ts-ignore internal modules are not typed
import { LegacyActionSequence } from 'selenium-webdriver/lib/actions';
Expand Down Expand Up @@ -471,7 +471,7 @@ export async function BrowserProvider({ getService }: FtrProviderContext) {
): Promise<R> {
return await driver.executeScript(
fn,
...cloneDeep<any>(args, (arg) => {
...cloneDeepWith<any>(args, (arg) => {
if (arg instanceof WebElementWrapper) {
return arg._webElement;
}
Expand All @@ -485,7 +485,7 @@ export async function BrowserProvider({ getService }: FtrProviderContext) {
): Promise<R> {
return await driver.executeAsyncScript(
fn,
...cloneDeep<any>(args, (arg) => {
...cloneDeepWith<any>(args, (arg) => {
if (arg instanceof WebElementWrapper) {
return arg._webElement;
}
Expand Down
1 change: 0 additions & 1 deletion test/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"include": [
"**/*.ts",
"**/*.tsx",
"../typings/lodash.topath/*.ts",
"../typings/elastic__node_crypto.d.ts",
"typings/**/*"
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import { postSnapshot } from '@percy/agent/dist/utils/sdk-utils';
import { Test } from 'mocha';
import _ from 'lodash';

import testSubjSelector from '@kbn/test-subj-selector';

Expand Down
23 changes: 0 additions & 23 deletions typings/lodash.topath/index.d.ts

This file was deleted.

0 comments on commit bf18a6c

Please sign in to comment.