From 5419268385c1c6046a3ae5e62179ad382585b326 Mon Sep 17 00:00:00 2001 From: Marco Vettorello Date: Thu, 21 Nov 2024 11:19:22 +0100 Subject: [PATCH 1/4] replace faker with @faker-js --- package.json | 2 - .../src/calculate_width_from_entries.test.ts | 16 +++-- packages/kbn-dom-drag-drop/src/test_utils.tsx | 4 +- .../field_picker/field_picker.test.tsx | 6 +- renovate.json | 21 +++++-- .../public/components/metric_vis.test.tsx | 58 +++++++++---------- .../public/utils/filter_helpers.test.ts | 20 +++---- .../definitions/percentile.test.tsx | 4 +- .../chart_switch/chart_switch.test.tsx | 2 +- .../config_panel/layer_header.test.tsx | 2 +- .../config_panel/layer_panel.test.tsx | 4 +- .../workspace_panel/workspace_panel.test.tsx | 2 +- .../workspace_panel_wrapper.test.tsx | 4 +- .../color_telemetry_helpers.test.ts | 4 +- .../lens/public/mocks/visualization_mock.tsx | 2 +- .../state_management/load_initial.test.tsx | 2 +- .../datatable/components/table_basic.test.tsx | 12 ++-- .../metric/dimension_editor.test.tsx | 8 +-- .../infra/public/test_utils/entries.ts | 10 ++-- .../logs_shared/public/test_utils/entries.ts | 10 ++-- .../scripts/generate_indicators.js | 2 +- .../utils/data_generator/get_timestamp.ts | 2 +- yarn.lock | 10 ---- 23 files changed, 101 insertions(+), 106 deletions(-) diff --git a/package.json b/package.json index 97b697d4bedf4..66760cb0ff2d9 100644 --- a/package.json +++ b/package.json @@ -1563,7 +1563,6 @@ "@types/eslint": "^8.44.2", "@types/express": "^4.17.21", "@types/extract-zip": "^1.6.2", - "@types/faker": "^5.1.5", "@types/fetch-mock": "^7.3.1", "@types/file-saver": "^2.0.0", "@types/flot": "^0.0.31", @@ -1731,7 +1730,6 @@ "expect": "^29.7.0", "expose-loader": "^0.7.5", "express": "^4.21.1", - "faker": "^5.1.0", "fetch-mock": "^7.3.9", "file-loader": "^4.2.0", "find-cypress-specs": "^1.41.4", diff --git a/packages/kbn-calculate-width-from-char-count/src/calculate_width_from_entries.test.ts b/packages/kbn-calculate-width-from-char-count/src/calculate_width_from_entries.test.ts index 9924ea7b84a14..89abd5d8ce667 100644 --- a/packages/kbn-calculate-width-from-char-count/src/calculate_width_from_entries.test.ts +++ b/packages/kbn-calculate-width-from-char-count/src/calculate_width_from_entries.test.ts @@ -9,24 +9,22 @@ import { calculateWidthFromEntries } from './calculate_width_from_entries'; import { MAX_WIDTH } from './calculate_width_from_char_count'; -import faker from 'faker'; - -const generateLabel = (length: number) => faker.random.alpha({ count: length }); +import { faker } from '@faker-js/faker'; const generateObjectWithLabelOfLength = (length: number, propOverrides?: Record) => ({ - label: generateLabel(length), + label: faker.string.alpha(length), ...propOverrides, }); describe('calculateWidthFromEntries', () => { it('calculates width for array of strings', () => { - const shortLabels = [10, 20].map(generateLabel); + const shortLabels = [10, 20].map(faker.string.alpha); expect(calculateWidthFromEntries(shortLabels)).toBe(256); - const mediumLabels = [50, 55, 10, 20].map(generateLabel); + const mediumLabels = [50, 55, 10, 20].map(faker.string.alpha); expect(calculateWidthFromEntries(mediumLabels)).toBe(501); - const longLabels = [80, 90, 10].map(generateLabel); + const longLabels = [80, 90, 10].map(faker.string.alpha); expect(calculateWidthFromEntries(longLabels)).toBe(MAX_WIDTH); }); @@ -42,12 +40,12 @@ describe('calculateWidthFromEntries', () => { }); it('calculates width for array of objects for fallback keys', () => { const shortLabels = [10, 20].map((v) => - generateObjectWithLabelOfLength(v, { label: undefined, name: generateLabel(v) }) + generateObjectWithLabelOfLength(v, { label: undefined, name: faker.string.alpha(v) }) ); expect(calculateWidthFromEntries(shortLabels, ['id', 'label', 'name'])).toBe(256); const mediumLabels = [50, 55, 10, 20].map((v) => - generateObjectWithLabelOfLength(v, { label: undefined, name: generateLabel(v) }) + generateObjectWithLabelOfLength(v, { label: undefined, name: faker.string.alpha(v) }) ); expect(calculateWidthFromEntries(mediumLabels, ['id', 'label', 'name'])).toBe(501); }); diff --git a/packages/kbn-dom-drag-drop/src/test_utils.tsx b/packages/kbn-dom-drag-drop/src/test_utils.tsx index 033697353a43f..84996956e26c3 100644 --- a/packages/kbn-dom-drag-drop/src/test_utils.tsx +++ b/packages/kbn-dom-drag-drop/src/test_utils.tsx @@ -8,7 +8,7 @@ */ import React, { ReactElement } from 'react'; -import faker from 'faker'; +import { faker } from '@faker-js/faker'; import { RenderOptions, render } from '@testing-library/react'; import { DragContextState, RootDragDropProvider } from './providers'; @@ -22,7 +22,7 @@ export const dataTransfer = { }; export const generateDragDropValue = (label = faker.lorem.word()) => ({ - id: faker.random.uuid(), + id: faker.string.uuid(), humanData: { label, groupLabel: faker.lorem.word(), diff --git a/packages/kbn-visualization-ui-components/components/field_picker/field_picker.test.tsx b/packages/kbn-visualization-ui-components/components/field_picker/field_picker.test.tsx index 6cdcfaaa8d0ad..a19de192662c2 100644 --- a/packages/kbn-visualization-ui-components/components/field_picker/field_picker.test.tsx +++ b/packages/kbn-visualization-ui-components/components/field_picker/field_picker.test.tsx @@ -10,15 +10,15 @@ import React from 'react'; import { FieldPicker, FieldPickerProps } from './field_picker'; import { render, screen } from '@testing-library/react'; -import faker from 'faker'; +import { faker } from '@faker-js/faker'; import userEvent from '@testing-library/user-event'; import { DataType, FieldOptionValue } from './types'; const generateFieldWithLabelOfLength = (length: number) => ({ - label: faker.random.alpha({ count: length }), + label: faker.string.alpha(length), value: { type: 'field' as const, - field: faker.random.alpha({ count: length }), + field: faker.string.alpha(length), dataType: 'date' as DataType, operationType: 'count', }, diff --git a/renovate.json b/renovate.json index 08c842400d671..a84df6af01226 100644 --- a/renovate.json +++ b/renovate.json @@ -137,12 +137,10 @@ "groupName": "@elastic/appex-qa dependencies", "matchDepNames": [ "cheerio", - "@types/faker", "@types/pixelmatch", "@types/pngjs", "@types/supertest", "babel-plugin-istanbul", - "faker", "nyc", "oboe", "pixelmatch", @@ -1303,10 +1301,21 @@ }, { "groupName": "@elastic/request-converter", - "matchDepNames": ["@elastic/request-converter"], - "reviewers": ["team:kibana-management"], - "matchBaseBranches": ["main"], - "labels": ["release_note:skip", "backport:skip", "Team:Kibana Management", "Feature:Console"], + "matchDepNames": [ + "@elastic/request-converter" + ], + "reviewers": [ + "team:kibana-management" + ], + "matchBaseBranches": [ + "main" + ], + "labels": [ + "release_note:skip", + "backport:skip", + "Team:Kibana Management", + "Feature:Console" + ], "enabled": true } ], diff --git a/src/plugins/chart_expressions/expression_metric/public/components/metric_vis.test.tsx b/src/plugins/chart_expressions/expression_metric/public/components/metric_vis.test.tsx index fd0892ea12735..e81801229b167 100644 --- a/src/plugins/chart_expressions/expression_metric/public/components/metric_vis.test.tsx +++ b/src/plugins/chart_expressions/expression_metric/public/components/metric_vis.test.tsx @@ -27,7 +27,7 @@ import { CustomPaletteState } from '@kbn/charts-plugin/common/expressions/palett import { DimensionsVisParam, MetricVisParam } from '../../common'; import { euiThemeVars } from '@kbn/ui-theme'; import { DEFAULT_TRENDLINE_NAME } from '../../common/constants'; -import faker from 'faker'; +import { faker } from '@faker-js/faker'; const mockDeserialize = jest.fn(({ id }: { id: string }) => { const convertFn = (v: unknown) => `${id}-${v}`; @@ -825,47 +825,47 @@ describe('MetricVisComponent', function () { // Raw values here, not formatted const trends: Record = { Friday: [ - { x: faker.random.number(), y: faker.random.number() }, - { x: faker.random.number(), y: faker.random.number() }, - { x: faker.random.number(), y: faker.random.number() }, - { x: faker.random.number(), y: faker.random.number() }, + { x: faker.number.int(), y: faker.number.int() }, + { x: faker.number.int(), y: faker.number.int() }, + { x: faker.number.int(), y: faker.number.int() }, + { x: faker.number.int(), y: faker.number.int() }, ], Wednesday: [ - { x: faker.random.number(), y: faker.random.number() }, - { x: faker.random.number(), y: faker.random.number() }, - { x: faker.random.number(), y: faker.random.number() }, - { x: faker.random.number(), y: faker.random.number() }, + { x: faker.number.int(), y: faker.number.int() }, + { x: faker.number.int(), y: faker.number.int() }, + { x: faker.number.int(), y: faker.number.int() }, + { x: faker.number.int(), y: faker.number.int() }, ], Saturday: [ - { x: faker.random.number(), y: faker.random.number() }, - { x: faker.random.number(), y: faker.random.number() }, - { x: faker.random.number(), y: faker.random.number() }, - { x: faker.random.number(), y: faker.random.number() }, + { x: faker.number.int(), y: faker.number.int() }, + { x: faker.number.int(), y: faker.number.int() }, + { x: faker.number.int(), y: faker.number.int() }, + { x: faker.number.int(), y: faker.number.int() }, ], Sunday: [ - { x: faker.random.number(), y: faker.random.number() }, - { x: faker.random.number(), y: faker.random.number() }, - { x: faker.random.number(), y: faker.random.number() }, - { x: faker.random.number(), y: faker.random.number() }, + { x: faker.number.int(), y: faker.number.int() }, + { x: faker.number.int(), y: faker.number.int() }, + { x: faker.number.int(), y: faker.number.int() }, + { x: faker.number.int(), y: faker.number.int() }, ], Thursday: [ - { x: faker.random.number(), y: faker.random.number() }, - { x: faker.random.number(), y: faker.random.number() }, - { x: faker.random.number(), y: faker.random.number() }, - { x: faker.random.number(), y: faker.random.number() }, + { x: faker.number.int(), y: faker.number.int() }, + { x: faker.number.int(), y: faker.number.int() }, + { x: faker.number.int(), y: faker.number.int() }, + { x: faker.number.int(), y: faker.number.int() }, ], __other__: [ - { x: faker.random.number(), y: faker.random.number() }, - { x: faker.random.number(), y: faker.random.number() }, - { x: faker.random.number(), y: faker.random.number() }, - { x: faker.random.number(), y: faker.random.number() }, + { x: faker.number.int(), y: faker.number.int() }, + { x: faker.number.int(), y: faker.number.int() }, + { x: faker.number.int(), y: faker.number.int() }, + { x: faker.number.int(), y: faker.number.int() }, ], // this one shouldn't show up! [DEFAULT_TRENDLINE_NAME]: [ - { x: faker.random.number(), y: faker.random.number() }, - { x: faker.random.number(), y: faker.random.number() }, - { x: faker.random.number(), y: faker.random.number() }, - { x: faker.random.number(), y: faker.random.number() }, + { x: faker.number.int(), y: faker.number.int() }, + { x: faker.number.int(), y: faker.number.int() }, + { x: faker.number.int(), y: faker.number.int() }, + { x: faker.number.int(), y: faker.number.int() }, ], }; diff --git a/src/plugins/chart_expressions/expression_partition_vis/public/utils/filter_helpers.test.ts b/src/plugins/chart_expressions/expression_partition_vis/public/utils/filter_helpers.test.ts index babde416ea0a5..d9a6bb9d95631 100644 --- a/src/plugins/chart_expressions/expression_partition_vis/public/utils/filter_helpers.test.ts +++ b/src/plugins/chart_expressions/expression_partition_vis/public/utils/filter_helpers.test.ts @@ -18,7 +18,7 @@ import { import { createMockBucketColumns, createMockVisData, createMockPieParams } from '../mocks'; import { consolidateMetricColumns } from '../../common/utils'; import { LayerValue } from '@elastic/charts'; -import faker from 'faker'; +import { faker } from '@faker-js/faker'; const bucketColumns = createMockBucketColumns(); const visData = createMockVisData(); @@ -186,26 +186,26 @@ describe('getFilterClickData', () => { const clickedLayers: LayerValue[] = [ { groupByRollup: 'circle', - value: faker.random.number(), - depth: faker.random.number(), + value: faker.number.int(), + depth: faker.number.int(), path: [], - sortIndex: faker.random.number(), + sortIndex: faker.number.int(), smAccessorValue: '', }, { groupByRollup: 'green', - value: faker.random.number(), - depth: faker.random.number(), + value: faker.number.int(), + depth: faker.number.int(), path: [], - sortIndex: faker.random.number(), + sortIndex: faker.number.int(), smAccessorValue: '', }, { groupByRollup: 'metric2', - value: faker.random.number(), - depth: faker.random.number(), + value: faker.number.int(), + depth: faker.number.int(), path: [], - sortIndex: faker.random.number(), + sortIndex: faker.number.int(), smAccessorValue: '', }, ]; diff --git a/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/percentile.test.tsx b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/percentile.test.tsx index a140ca22db2b5..b8d3af522c455 100644 --- a/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/percentile.test.tsx +++ b/x-pack/plugins/lens/public/datasources/form_based/operations/definitions/percentile.test.tsx @@ -12,7 +12,7 @@ import { unifiedSearchPluginMock } from '@kbn/unified-search-plugin/public/mocks import { IStorageWrapper } from '@kbn/kibana-utils-plugin/public'; import { dataPluginMock } from '@kbn/data-plugin/public/mocks'; import { dataViewPluginMocks } from '@kbn/data-views-plugin/public/mocks'; -import faker from 'faker'; +import { faker } from '@faker-js/faker'; import { render, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { createMockedIndexPattern } from '../../mocks'; @@ -402,7 +402,7 @@ describe('percentile', () => { it('should update order-by references for any terms columns', () => { const field1 = 'foo'; const field2 = 'bar'; - const percentile = faker.random.number(100); + const percentile = faker.number.int(100); const aggs = [ makeEsAggBuilder('aggTerms', { diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/chart_switch/chart_switch.test.tsx b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/chart_switch/chart_switch.test.tsx index 6795cd8caaa83..5686d94f52d49 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/chart_switch/chart_switch.test.tsx +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/chart_switch/chart_switch.test.tsx @@ -21,7 +21,7 @@ import { DatasourcePublicAPI, SuggestionRequest, DatasourceSuggestion } from '.. import { ChartSwitchProps } from './chart_switch'; import { ChartSwitchPopover } from './chart_switch_popover'; import { LensAppState, applyChanges } from '../../../../state_management'; -import faker from 'faker'; +import { faker } from '@faker-js/faker'; const mockFrame = (layers: string[]) => ({ ...createMockFramePublicAPI(), diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/layer_header.test.tsx b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/layer_header.test.tsx index 6f0edd6cbcd16..bcd21c71312ce 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/layer_header.test.tsx +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/layer_header.test.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { screen } from '@testing-library/react'; -import faker from 'faker'; +import { faker } from '@faker-js/faker'; import { createMockDatasource, createMockFramePublicAPI, diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/layer_panel.test.tsx b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/layer_panel.test.tsx index 9c3457dacc6d4..9cfb1597ffdd4 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/layer_panel.test.tsx +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/config_panel/layer_panel.test.tsx @@ -12,7 +12,7 @@ import { ChildDragDropProvider, Droppable, Draggable } from '@kbn/dom-drag-drop' import { FramePublicAPI, Visualization, VisualizationConfigProps } from '../../../types'; import { LayerPanel } from './layer_panel'; import { coreMock } from '@kbn/core/public/mocks'; -import faker from 'faker'; +import { faker } from '@faker-js/faker'; import { generateId } from '../../../id_generator'; import { createMockVisualization, @@ -144,7 +144,7 @@ describe('LayerPanel', () => { }; beforeEach(() => { - mockVisualization = createMockVisualization(faker.random.alphaNumeric()); + mockVisualization = createMockVisualization(faker.string.alphanumeric()); mockVisualization.getLayerIds.mockReturnValue(['first']); mockDatasource = createMockDatasource(); }); diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel.test.tsx b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel.test.tsx index 42abcdf8fe56c..e44e528e5a33c 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel.test.tsx +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel.test.tsx @@ -39,7 +39,7 @@ import { getLensInspectorService } from '../../../lens_inspector_service'; import { inspectorPluginMock } from '@kbn/inspector-plugin/public/mocks'; import { disableAutoApply, enableAutoApply } from '../../../state_management/lens_slice'; import { Ast, toExpression } from '@kbn/interpreter'; -import faker from 'faker'; +import { faker } from '@faker-js/faker'; const defaultPermissions: Record>> = { navLinks: { management: true }, diff --git a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel_wrapper.test.tsx b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel_wrapper.test.tsx index 8694cc7c27dcf..c5cabaa053c4b 100644 --- a/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel_wrapper.test.tsx +++ b/x-pack/plugins/lens/public/editor_frame_service/editor_frame/workspace_panel/workspace_panel_wrapper.test.tsx @@ -18,7 +18,7 @@ import { updateVisualizationState, LensAppState } from '../../../state_managemen import { setChangesApplied } from '../../../state_management/lens_slice'; import { LensInspector } from '../../../lens_inspector_service'; import { screen } from '@testing-library/react'; -import faker from 'faker'; +import { faker } from '@faker-js/faker'; import { SettingsMenu } from '../../../app_plugin/settings_menu'; describe('workspace_panel_wrapper', () => { @@ -98,7 +98,7 @@ describe('workspace_panel_wrapper', () => { }); it('should render its children', async () => { - const customElementText = faker.random.word(); + const customElementText = faker.word.words(); renderWorkspacePanelWrapper({ children: {customElementText} }); expect(screen.getByText(customElementText)).toBeInTheDocument(); }); diff --git a/x-pack/plugins/lens/public/lens_ui_telemetry/color_telemetry_helpers.test.ts b/x-pack/plugins/lens/public/lens_ui_telemetry/color_telemetry_helpers.test.ts index 47eba8b0252ef..8719c54f6f1dd 100644 --- a/x-pack/plugins/lens/public/lens_ui_telemetry/color_telemetry_helpers.test.ts +++ b/x-pack/plugins/lens/public/lens_ui_telemetry/color_telemetry_helpers.test.ts @@ -13,7 +13,7 @@ import { DEFAULT_COLOR_MAPPING_CONFIG, DEFAULT_OTHER_ASSIGNMENT_INDEX, } from '@kbn/coloring'; -import faker from 'faker'; +import { faker } from '@faker-js/faker'; const exampleAssignment = ( valuesCount = 1, @@ -35,7 +35,7 @@ const exampleAssignment = ( return { rule: { type: 'matchExactly', - values: Array.from({ length: valuesCount }, () => faker.random.alpha()), + values: Array.from({ length: valuesCount }, () => faker.string.alpha()), }, color, touched: false, diff --git a/x-pack/plugins/lens/public/mocks/visualization_mock.tsx b/x-pack/plugins/lens/public/mocks/visualization_mock.tsx index f0513e66de0c5..9810b916d5ea6 100644 --- a/x-pack/plugins/lens/public/mocks/visualization_mock.tsx +++ b/x-pack/plugins/lens/public/mocks/visualization_mock.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { LayerTypes } from '@kbn/expression-xy-plugin/public'; import { toExpression } from '@kbn/interpreter'; -import faker from 'faker'; +import { faker } from '@faker-js/faker'; import { Visualization, VisualizationMap } from '../types'; export function createMockVisualization( diff --git a/x-pack/plugins/lens/public/state_management/load_initial.test.tsx b/x-pack/plugins/lens/public/state_management/load_initial.test.tsx index a70b713787ce0..e40b0fbb368e9 100644 --- a/x-pack/plugins/lens/public/state_management/load_initial.test.tsx +++ b/x-pack/plugins/lens/public/state_management/load_initial.test.tsx @@ -18,7 +18,7 @@ import { act } from 'react-dom/test-utils'; import { LensEmbeddableInput } from '../embeddable'; import { loadInitial } from './lens_slice'; import { Filter } from '@kbn/es-query'; -import faker from 'faker'; +import { faker } from '@faker-js/faker'; const history = { location: { diff --git a/x-pack/plugins/lens/public/visualizations/datatable/components/table_basic.test.tsx b/x-pack/plugins/lens/public/visualizations/datatable/components/table_basic.test.tsx index 14b3796fbd145..992e79681d415 100644 --- a/x-pack/plugins/lens/public/visualizations/datatable/components/table_basic.test.tsx +++ b/x-pack/plugins/lens/public/visualizations/datatable/components/table_basic.test.tsx @@ -9,7 +9,7 @@ import React from 'react'; import { fireEvent, render, screen, within } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { I18nProvider } from '@kbn/i18n-react'; -import faker from 'faker'; +import { faker } from '@faker-js/faker'; import { act } from 'react-dom/test-utils'; import { IFieldFormat } from '@kbn/field-formats-plugin/common'; import { coreMock } from '@kbn/core/public/mocks'; @@ -504,7 +504,7 @@ describe('DatatableComponent', () => { data.rows = new Array(rowNumbers).fill({ a: 'shoes', b: 1588024800000, - c: faker.random.number(), + c: faker.number.int(), }); args.pageSize = pageSize; @@ -537,7 +537,7 @@ describe('DatatableComponent', () => { data.rows = new Array(rowNumbers).fill({ a: 'shoes', b: 1588024800000, - c: faker.random.number(), + c: faker.number.int(), }); args.pageSize = pageSize; @@ -558,7 +558,7 @@ describe('DatatableComponent', () => { data.rows = new Array(20).fill({ a: 'shoes', b: 1588024800000, - c: faker.random.number(), + c: faker.number.int(), }); renderDatatableComponent({ args, @@ -584,7 +584,7 @@ describe('DatatableComponent', () => { data.rows = new Array(rowNumbers).fill({ a: 'shoes', b: 1588024800000, - c: faker.random.number(), + c: faker.number.int(), }); args.pageSize = pageSize; @@ -624,7 +624,7 @@ describe('DatatableComponent', () => { data.rows = new Array(rowNumbers).fill({ a: 'shoes', b: 1588024800000, - c: faker.random.number(), + c: faker.number.int(), }); args.pageSize = pageSize; diff --git a/x-pack/plugins/lens/public/visualizations/metric/dimension_editor.test.tsx b/x-pack/plugins/lens/public/visualizations/metric/dimension_editor.test.tsx index 73f07d66bcb8b..7a143d3c9ba8a 100644 --- a/x-pack/plugins/lens/public/visualizations/metric/dimension_editor.test.tsx +++ b/x-pack/plugins/lens/public/visualizations/metric/dimension_editor.test.tsx @@ -7,7 +7,7 @@ import React from 'react'; import { render, screen, waitFor } from '@testing-library/react'; -import faker from 'faker'; +import { faker } from '@faker-js/faker'; import userEvent from '@testing-library/user-event'; import { chartPluginMock } from '@kbn/charts-plugin/public/mocks'; import { euiLightVars } from '@kbn/ui-theme'; @@ -77,7 +77,7 @@ describe('dimension editor', () => { id: 'first', rows: Array(3).fill({ 'metric-col-id': faker.lorem.word(3), - 'max-col-id': faker.random.number(), + 'max-col-id': faker.number.int(), }), }, ]), @@ -106,8 +106,8 @@ describe('dimension editor', () => { { id: 'first', rows: Array(3).fill({ - 'metric-col-id': faker.random.number(), - 'secondary-metric-col-id': faker.random.number(), + 'metric-col-id': faker.number.int(), + 'secondary-metric-col-id': faker.number.int(), }), }, ]), diff --git a/x-pack/plugins/observability_solution/infra/public/test_utils/entries.ts b/x-pack/plugins/observability_solution/infra/public/test_utils/entries.ts index 0b04c90ee633d..7042a6538dceb 100644 --- a/x-pack/plugins/observability_solution/infra/public/test_utils/entries.ts +++ b/x-pack/plugins/observability_solution/infra/public/test_utils/entries.ts @@ -5,7 +5,7 @@ * 2.0. */ -import faker from 'faker'; +import { faker } from '@faker-js/faker'; import { LogEntry, LogViewColumnConfiguration } from '@kbn/logs-shared-plugin/common'; export function generateFakeEntries( @@ -51,15 +51,15 @@ export function generateFakeEntries( function fakeColumnValue(field: string): string { switch (field) { case 'message': - return faker.fake( - '{{internet.ip}} - [{{date.past}}] "GET {{internet.url}} HTTP/1.1" 200 {{random.number}} "-" "{{internet.userAgent}}"' + return faker.helpers.fake( + '{{internet.ip}} - [{{date.past}}] "GET {{internet.url}} HTTP/1.1" 200 {{number.int}} "-" "{{internet.userAgent}}"' ); case 'event.dataset': - return faker.fake('{{hacker.noun}}.{{hacker.noun}}'); + return faker.helpers.fake('{{hacker.noun}}.{{hacker.noun}}'); case 'log.file.path': return faker.system.filePath(); case 'log.level': - return faker.random.arrayElement(['debug', 'info', 'warn', 'error']); + return faker.helpers.arrayElement(['debug', 'info', 'warn', 'error']); case 'host.name': return faker.hacker.noun(); default: diff --git a/x-pack/plugins/observability_solution/logs_shared/public/test_utils/entries.ts b/x-pack/plugins/observability_solution/logs_shared/public/test_utils/entries.ts index 5277f49b1175e..dc6a1526bba0c 100644 --- a/x-pack/plugins/observability_solution/logs_shared/public/test_utils/entries.ts +++ b/x-pack/plugins/observability_solution/logs_shared/public/test_utils/entries.ts @@ -5,7 +5,7 @@ * 2.0. */ -import faker from 'faker'; +import { faker } from '@faker-js/faker'; import { LogEntry } from '../../common/log_entry'; import { LogViewColumnConfiguration } from '../../common/log_views'; @@ -60,15 +60,15 @@ export function generateFakeEntries( function fakeColumnValue(field: string): string { switch (field) { case 'message': - return faker.fake( - '{{internet.ip}} - [{{date.past}}] "GET {{internet.url}} HTTP/1.1" 200 {{random.number}} "-" "{{internet.userAgent}}"' + return faker.helpers.fake( + '{{internet.ip}} - [{{date.past}}] "GET {{internet.url}} HTTP/1.1" 200 {{number.int}} "-" "{{internet.userAgent}}"' ); case 'event.dataset': - return faker.fake('{{hacker.noun}}.{{hacker.noun}}'); + return faker.helpers.fake('{{hacker.noun}}.{{hacker.noun}}'); case 'log.file.path': return faker.system.filePath(); case 'log.level': - return faker.random.arrayElement(['debug', 'info', 'warn', 'error']); + return faker.helpers.arrayElement(['debug', 'info', 'warn', 'error']); case 'host.name': return faker.hacker.noun(); default: diff --git a/x-pack/plugins/threat_intelligence/scripts/generate_indicators.js b/x-pack/plugins/threat_intelligence/scripts/generate_indicators.js index 0d5c170965fe7..daa869c76cf70 100644 --- a/x-pack/plugins/threat_intelligence/scripts/generate_indicators.js +++ b/x-pack/plugins/threat_intelligence/scripts/generate_indicators.js @@ -6,7 +6,7 @@ */ const { Client } = require('@elastic/elasticsearch'); -const faker = require('faker'); +const { faker } = require('@faker-js/faker'); const THREAT_INDEX = 'logs-ti'; diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/data_generator/get_timestamp.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/data_generator/get_timestamp.ts index e828767a39650..e73211b053959 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/data_generator/get_timestamp.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/data_generator/get_timestamp.ts @@ -4,7 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import faker from 'faker'; +import { faker } from '@faker-js/faker'; import type { IndexingInterval } from './types'; export const getTimestamp = (interval?: IndexingInterval) => { diff --git a/yarn.lock b/yarn.lock index d5acff31b563b..d2420ba2c02f6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11435,11 +11435,6 @@ resolved "https://registry.yarnpkg.com/@types/extract-zip/-/extract-zip-1.6.2.tgz#5c7eb441c41136167a42b88b64051e6260c29e86" integrity sha1-XH60QcQRNhZ6QriLZAUeYmDCnoY= -"@types/faker@^5.1.5": - version "5.1.5" - resolved "https://registry.yarnpkg.com/@types/faker/-/faker-5.1.5.tgz#f14b015e0100232bb00c6dd7611505efb08709a0" - integrity sha512-2uEQFb7bsx68rqD4F8q95wZq6LTLOyexjv6BnvJogCO4jStkyc6IDEkODPQcWfovI6g6M3uPQ2/uD/oedJKkNw== - "@types/fetch-mock@^7.3.1": version "7.3.1" resolved "https://registry.yarnpkg.com/@types/fetch-mock/-/fetch-mock-7.3.1.tgz#df7421e8bcb351b430bfbfa5c52bb353826ac94f" @@ -18700,11 +18695,6 @@ extsprintf@1.3.0, extsprintf@^1.2.0: resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05" integrity sha1-lpGEQOMEGnpBT4xS48V06zw+HgU= -faker@^5.1.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/faker/-/faker-5.1.0.tgz#e10fa1dec4502551aee0eb771617a7e7b94692e8" - integrity sha512-RrWKFSSA/aNLP0g3o2WW1Zez7/MnMr7xkiZmoCfAGZmdkDQZ6l2KtuXHN5XjdvpRjDl8+3vf+Rrtl06Z352+Mw== - fancy-log@^1.3.3: version "1.3.3" resolved "https://registry.yarnpkg.com/fancy-log/-/fancy-log-1.3.3.tgz#dbc19154f558690150a23953a0adbd035be45fc7" From fe58d0684404b7a16694aef7776a5b3c296d8c61 Mon Sep 17 00:00:00 2001 From: Marco Vettorello Date: Fri, 29 Nov 2024 18:39:17 +0100 Subject: [PATCH 2/4] fix faker mocking --- .../inference/connector.test.tsx | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/x-pack/plugins/stack_connectors/public/connector_types/inference/connector.test.tsx b/x-pack/plugins/stack_connectors/public/connector_types/inference/connector.test.tsx index d445504011b5f..4b4beb16d798e 100644 --- a/x-pack/plugins/stack_connectors/public/connector_types/inference/connector.test.tsx +++ b/x-pack/plugins/stack_connectors/public/connector_types/inference/connector.test.tsx @@ -25,13 +25,19 @@ jest.mock('@kbn/triggers-actions-ui-plugin/public/common/lib/kibana', () => ({ })), })); -jest.mock('@faker-js/faker', () => ({ - faker: { - string: { - alpha: jest.fn().mockReturnValue('123'), +jest.mock('@faker-js/faker', () => { + const originalModule = jest.requireActual('@faker-js/faker'); + return { + ...originalModule, + faker: { + ...originalModule.faker, + string: { + ...originalModule.faker.string, + alpha: jest.fn().mockReturnValue('123'), + }, }, - }, -})); + }; +}); const mockProviders = useProviders as jest.Mock; From 934606cd33227d109ce92a3f0cae5b29b15e12a2 Mon Sep 17 00:00:00 2001 From: Marco Vettorello Date: Fri, 29 Nov 2024 18:51:07 +0100 Subject: [PATCH 3/4] fix timestamps order --- .../indicator_match_alert_suppression.ts | 2 +- .../detections_response/utils/data_generator/get_timestamp.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/indicator_match/trial_license_complete_tier/indicator_match_alert_suppression.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/indicator_match/trial_license_complete_tier/indicator_match_alert_suppression.ts index 1acb416808081..6ede4121610e6 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/indicator_match/trial_license_complete_tier/indicator_match_alert_suppression.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/detection_engine/rule_execution_logic/indicator_match/trial_license_complete_tier/indicator_match_alert_suppression.ts @@ -1250,7 +1250,7 @@ export default ({ getService }: FtrProviderContext) => { await indexGeneratedSourceDocuments({ docsCount: 60000, - interval: [firstTimestamp, '2020-10-28T05:35:50.000Z'], + interval: [firstTimestamp, '2020-10-28T05:45:50.000Z'], seed: (index, _, timestamp) => ({ id, '@timestamp': timestamp, diff --git a/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/data_generator/get_timestamp.ts b/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/data_generator/get_timestamp.ts index e73211b053959..eb0de446d09d2 100644 --- a/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/data_generator/get_timestamp.ts +++ b/x-pack/test/security_solution_api_integration/test_suites/detections_response/utils/data_generator/get_timestamp.ts @@ -9,7 +9,7 @@ import type { IndexingInterval } from './types'; export const getTimestamp = (interval?: IndexingInterval) => { if (interval) { - return faker.date.between(...interval).toISOString(); + return faker.date.between({ from: interval[0], to: interval[1] }).toISOString(); } return new Date().toISOString(); From 04cc66c9a94713dff154829e33ba4bea3336c90a Mon Sep 17 00:00:00 2001 From: Marco Vettorello Date: Fri, 29 Nov 2024 18:59:21 +0100 Subject: [PATCH 4/4] replace remaning usage of faker --- .../public/components/metric_vis.test.tsx | 2 +- x-pack/plugins/lens/public/app_plugin/app.test.tsx | 8 ++++---- x-pack/plugins/lens/public/app_plugin/app_helpers.test.ts | 2 +- .../lens/public/app_plugin/save_modal_container.test.tsx | 8 ++++---- .../public/react_embeddable/expressions/on_event.test.ts | 8 ++++---- .../initializers/initialize_actions.test.ts | 4 ++-- .../initializers/initialize_dashboard_service.test.ts | 4 ++-- .../plugins/lens/public/react_embeddable/mocks/index.tsx | 8 ++++---- 8 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/plugins/chart_expressions/expression_metric/public/components/metric_vis.test.tsx b/src/plugins/chart_expressions/expression_metric/public/components/metric_vis.test.tsx index e81801229b167..38d8e4d695c8d 100644 --- a/src/plugins/chart_expressions/expression_metric/public/components/metric_vis.test.tsx +++ b/src/plugins/chart_expressions/expression_metric/public/components/metric_vis.test.tsx @@ -1004,7 +1004,7 @@ describe('MetricVisComponent', function () { }); it('should convert null values to NaN', () => { - const metricId = faker.random.word(); + const metricId = faker.lorem.word(); const tableWNull: Datatable = { type: 'datatable', diff --git a/x-pack/plugins/lens/public/app_plugin/app.test.tsx b/x-pack/plugins/lens/public/app_plugin/app.test.tsx index 73fb52bbe6683..c146352ede566 100644 --- a/x-pack/plugins/lens/public/app_plugin/app.test.tsx +++ b/x-pack/plugins/lens/public/app_plugin/app.test.tsx @@ -34,7 +34,7 @@ import { setState, LensAppState } from '../state_management'; import { coreMock } from '@kbn/core/public/mocks'; import { LensSerializedState } from '..'; import { createMockedField, createMockedIndexPattern } from '../datasources/form_based/mocks'; -import faker from 'faker'; +import { faker } from '@faker-js/faker'; import { screen, waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { VisualizeEditorContext } from '../types'; @@ -48,7 +48,7 @@ jest.mock('lodash', () => ({ debounce: (fn: unknown) => fn, })); -const defaultSavedObjectId: string = faker.random.uuid(); +const defaultSavedObjectId: string = faker.string.uuid(); const waitToLoad = async () => await act(async () => new Promise((resolve) => setTimeout(resolve, 0))); @@ -233,7 +233,7 @@ describe('Lens App', () => { }); describe('breadcrumbs', () => { - const breadcrumbDocSavedObjectId = faker.random.uuid(); + const breadcrumbDocSavedObjectId = faker.string.uuid(); const breadcrumbDoc = getLensDocumentMock({ savedObjectId: breadcrumbDocSavedObjectId, title: 'Daaaaaaadaumching!', @@ -601,7 +601,7 @@ describe('Lens App', () => { expect(lensStore.getState().lens.applyChangesCounter).toBe(1); }); it('adds to the recently accessed list on save', async () => { - const savedObjectId = faker.random.uuid(); + const savedObjectId = faker.string.uuid(); await save({ savedObjectId, prevSavedObjectId: 'prevId', comesFromDashboard: false }); expect(services.chrome.recentlyAccessed.add).toHaveBeenCalledWith( `/app/lens#/edit/${savedObjectId}`, diff --git a/x-pack/plugins/lens/public/app_plugin/app_helpers.test.ts b/x-pack/plugins/lens/public/app_plugin/app_helpers.test.ts index 7dc4e8cfda78c..773276710f48d 100644 --- a/x-pack/plugins/lens/public/app_plugin/app_helpers.test.ts +++ b/x-pack/plugins/lens/public/app_plugin/app_helpers.test.ts @@ -6,7 +6,7 @@ */ import { renderHook, act } from '@testing-library/react-hooks'; -import faker from 'faker'; +import { faker } from '@faker-js/faker'; import { UseNavigateBackToAppProps, useNavigateBackToApp } from './app_helpers'; import { defaultDoc, makeDefaultServices } from '../mocks/services_mock'; import { cloneDeep } from 'lodash'; diff --git a/x-pack/plugins/lens/public/app_plugin/save_modal_container.test.tsx b/x-pack/plugins/lens/public/app_plugin/save_modal_container.test.tsx index 987b320b3abf1..5d9c833174ed5 100644 --- a/x-pack/plugins/lens/public/app_plugin/save_modal_container.test.tsx +++ b/x-pack/plugins/lens/public/app_plugin/save_modal_container.test.tsx @@ -8,7 +8,7 @@ import { SaveProps } from './app'; import { type SaveVisualizationProps, runSaveLensVisualization } from './save_modal_container'; import { defaultDoc, makeDefaultServices } from '../mocks'; -import faker from 'faker'; +import { faker } from '@faker-js/faker'; import { makeAttributeService } from '../mocks/services_mock'; jest.mock('../persistence/saved_objects_utils/check_for_duplicate_title', () => ({ @@ -241,7 +241,7 @@ describe('runSaveLensVisualization', () => { }); // save the current document as a new by-value copy and add it to a dashboard it('should save as a new by-value copy and redirect to the dashboard', async () => { - const dashboardId = faker.random.uuid(); + const dashboardId = faker.string.uuid(); const { props, saveProps, options, redirectToDashboardFn, saveToLibraryFn, toasts } = getDefaultArgs( { @@ -271,7 +271,7 @@ describe('runSaveLensVisualization', () => { // save the current document as a new by-ref copy and add it to a dashboard it('should save as a new by-ref copy and redirect to the dashboard', async () => { - const dashboardId = faker.random.uuid(); + const dashboardId = faker.string.uuid(); const { props, saveProps, options, redirectToDashboardFn, saveToLibraryFn, toasts } = getDefaultArgs( { @@ -376,7 +376,7 @@ describe('runSaveLensVisualization', () => { // simulate a new save const attributeServiceMock = makeAttributeService({ ...defaultDoc, - savedObjectId: faker.random.uuid(), + savedObjectId: faker.string.uuid(), }); const { props, saveProps, options, saveToLibraryFn, cleanupEditor } = getDefaultArgs( diff --git a/x-pack/plugins/lens/public/react_embeddable/expressions/on_event.test.ts b/x-pack/plugins/lens/public/react_embeddable/expressions/on_event.test.ts index dfddfe84b57cc..aba94db03de88 100644 --- a/x-pack/plugins/lens/public/react_embeddable/expressions/on_event.test.ts +++ b/x-pack/plugins/lens/public/react_embeddable/expressions/on_event.test.ts @@ -9,7 +9,7 @@ import { ExpressionRendererEvent } from '@kbn/expressions-plugin/public'; import { getLensApiMock, getLensRuntimeStateMock, makeEmbeddableServices } from '../mocks'; import { LensApi, LensEmbeddableStartServices, LensPublicCallbacks } from '../types'; import { prepareEventHandler } from './on_event'; -import faker from 'faker'; +import { faker } from '@faker-js/faker'; import { LENS_EDIT_PAGESIZE_ACTION, LENS_EDIT_RESIZE_ACTION, @@ -109,7 +109,7 @@ describe('Embeddable interaction event handlers', () => { const event = { name: 'filter', data: { - data: [{ value: faker.random.number(), row: 1, column: 'test', table: getTable() }], + data: [{ value: faker.number.int(), row: 1, column: 'test', table: getTable() }], }, }; const { callbacks } = await submitEvent(event); @@ -119,7 +119,7 @@ describe('Embeddable interaction event handlers', () => { const event = { name: 'filter', data: { - data: [{ value: faker.random.number(), row: 1, column: 'test', table: getTable() }], + data: [{ value: faker.number.int(), row: 1, column: 'test', table: getTable() }], }, }; const { getTrigger } = await submitEvent(event, true); @@ -171,7 +171,7 @@ describe('Embeddable interaction event handlers', () => { await reSubmit({ name: 'filter', data: { - data: [{ value: faker.random.number(), row: 1, column: 'test', table: getTable() }], + data: [{ value: faker.number.int(), row: 1, column: 'test', table: getTable() }], }, }); diff --git a/x-pack/plugins/lens/public/react_embeddable/initializers/initialize_actions.test.ts b/x-pack/plugins/lens/public/react_embeddable/initializers/initialize_actions.test.ts index a4f84c329bd3c..016bc0e87f11d 100644 --- a/x-pack/plugins/lens/public/react_embeddable/initializers/initialize_actions.test.ts +++ b/x-pack/plugins/lens/public/react_embeddable/initializers/initialize_actions.test.ts @@ -6,7 +6,7 @@ */ import { pick } from 'lodash'; -import faker from 'faker'; +import { faker } from '@faker-js/faker'; import type { LensRuntimeState, VisualizationContext } from '../types'; import { initializeActionApi } from './initialize_actions'; import { @@ -42,7 +42,7 @@ function setupActionsApi( visOverrides: { id: 'lnsXY' }, dataOverrides: { id: 'form_based' }, }); - const uuid = faker.random.uuid(); + const uuid = faker.string.uuid(); const runtimeState = getLensRuntimeStateMock(stateOverrides); const apiMock = getLensApiMock(); diff --git a/x-pack/plugins/lens/public/react_embeddable/initializers/initialize_dashboard_service.test.ts b/x-pack/plugins/lens/public/react_embeddable/initializers/initialize_dashboard_service.test.ts index 2a0c469b3bbfb..af68f887bff54 100644 --- a/x-pack/plugins/lens/public/react_embeddable/initializers/initialize_dashboard_service.test.ts +++ b/x-pack/plugins/lens/public/react_embeddable/initializers/initialize_dashboard_service.test.ts @@ -9,7 +9,7 @@ import type { LensRuntimeState } from '../types'; import { getLensRuntimeStateMock, getLensInternalApiMock, makeEmbeddableServices } from '../mocks'; import { initializeStateManagement } from './initialize_state_management'; import { initializeDashboardServices } from './initialize_dashboard_services'; -import faker from 'faker'; +import { faker } from '@faker-js/faker'; import { createEmptyLensState } from '../helper'; function setupDashboardServicesApi(runtimeOverrides?: Partial) { @@ -30,7 +30,7 @@ function setupDashboardServicesApi(runtimeOverrides?: Partial) describe('Transformation API', () => { it("should not save to library if there's already a saveObjectId", async () => { - const api = setupDashboardServicesApi({ savedObjectId: faker.random.uuid() }); + const api = setupDashboardServicesApi({ savedObjectId: faker.string.uuid() }); expect(await api.canLinkToLibrary()).toBe(false); }); diff --git a/x-pack/plugins/lens/public/react_embeddable/mocks/index.tsx b/x-pack/plugins/lens/public/react_embeddable/mocks/index.tsx index ddcd5e6089592..ca8f489a711aa 100644 --- a/x-pack/plugins/lens/public/react_embeddable/mocks/index.tsx +++ b/x-pack/plugins/lens/public/react_embeddable/mocks/index.tsx @@ -8,7 +8,7 @@ import { BehaviorSubject, Subject } from 'rxjs'; import deepMerge from 'deepmerge'; import React from 'react'; -import faker from 'faker'; +import { faker } from '@faker-js/faker'; import { Query, Filter, AggregateQuery, TimeRange } from '@kbn/es-query'; import { PhaseEvent, ViewMode } from '@kbn/presentation-publishing'; import { DataView } from '@kbn/data-views-plugin/common'; @@ -49,7 +49,7 @@ import { const LensApiMock: LensApi = { // Static props type: DOC_TYPE, - uuid: faker.random.uuid(), + uuid: faker.string.uuid(), // Shared Embeddable Observables panelTitle: new BehaviorSubject(faker.lorem.words()), hidePanelTitle: new BehaviorSubject(false), @@ -94,7 +94,7 @@ const LensApiMock: LensApi = { setPanelTitle: jest.fn(), setHidePanelTitle: jest.fn(), phase$: new BehaviorSubject({ - id: faker.random.uuid(), + id: faker.string.uuid(), status: 'rendered', timeToEvent: 1000, }), @@ -138,7 +138,7 @@ export function getLensApiMock(overrides: Partial = {}) { export function getLensSerializedStateMock(overrides: Partial = {}) { return { - savedObjectId: faker.random.uuid(), + savedObjectId: faker.string.uuid(), ...LensSerializedStateMock, ...overrides, };