mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
[Lens] mock htmlIDGenerator to avoid messages when running tests (#101042)
This commit is contained in:
parent
38fd8a268a
commit
1f6e514de6
2 changed files with 26 additions and 0 deletions
|
@ -11,6 +11,19 @@ import React from 'react';
|
|||
import { act } from 'react-dom/test-utils';
|
||||
import { CustomStops, CustomStopsProps } from './color_stops';
|
||||
|
||||
// mocking random id generator function
|
||||
jest.mock('@elastic/eui', () => {
|
||||
const original = jest.requireActual('@elastic/eui');
|
||||
|
||||
return {
|
||||
...original,
|
||||
htmlIdGenerator: (fn: unknown) => {
|
||||
let counter = 0;
|
||||
return () => counter++;
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
describe('Color Stops component', () => {
|
||||
let props: CustomStopsProps;
|
||||
beforeEach(() => {
|
||||
|
|
|
@ -15,6 +15,19 @@ import { CustomPaletteParams } from './types';
|
|||
import { applyPaletteParams } from './utils';
|
||||
import { CustomizablePalette } from './palette_configuration';
|
||||
|
||||
// mocking random id generator function
|
||||
jest.mock('@elastic/eui', () => {
|
||||
const original = jest.requireActual('@elastic/eui');
|
||||
|
||||
return {
|
||||
...original,
|
||||
htmlIdGenerator: (fn: unknown) => {
|
||||
let counter = 0;
|
||||
return () => counter++;
|
||||
},
|
||||
};
|
||||
});
|
||||
|
||||
describe('palette utilities', () => {
|
||||
const paletteRegistry = chartPluginMock.createPaletteRegistry();
|
||||
describe('applyPaletteParams', () => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue