Skip to content

Commit

Permalink
fix JEST tests
Browse files Browse the repository at this point in the history
  • Loading branch information
alexwizp committed Dec 26, 2019
1 parent aea2047 commit 981c98d
Show file tree
Hide file tree
Showing 9 changed files with 1 addition and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,6 @@ const unmountComponentAtNode = jest.fn();

jest.doMock('react-dom', () => ({ render, unmountComponentAtNode }));

// If we don't mock this, Jest fails with the error `TypeError: Cannot redefine property: prototype
// at Function.defineProperties`.
jest.mock('ui/index_patterns', () => ({
INDEX_PATTERN_ILLEGAL_CHARACTERS: ['\\', '/', '?', '"', '<', '>', '|', ' '],
}));

jest.mock('ui/chrome', () => ({
getUiSettingsClient: () => ({
get: () => '',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,6 @@ const mockIndexPatternCreationType = {
checkIndicesForErrors: () => false,
getShowSystemIndices: () => false,
};
// If we don't mock this, Jest fails with the error `TypeError: Cannot redefine property: prototype
// at Function.defineProperties`.
jest.mock('ui/index_patterns', () => ({
INDEX_PATTERN_ILLEGAL_CHARACTERS: ['\\', '/', '?', '"', '<', '>', '|', ' '],
}));

jest.mock('ui/chrome', () => ({
getUiSettingsClient: () => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

jest.mock('ui/new_platform');
jest.mock('ui/index_patterns');

jest.mock('./kibana_services', () => {
return {
SPATIAL_FILTER_TYPE: 'spatial_filter',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ import { kibanaContextValueMock } from '../../../../../contexts/kibana/__mocks__

import { useCreateAnalyticsForm } from '../../hooks/use_create_analytics_form';

jest.mock('ui/index_patterns', () => ({
validateIndexPattern: () => true,
INDEX_PATTERN_ILLEGAL_CHARACTERS: [],
}));

const getMountedHook = () =>
mountHook(
() => useCreateAnalyticsForm(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ import { kibanaContextValueMock } from '../../../../../contexts/kibana/__mocks__

import { useCreateAnalyticsForm } from '../../hooks/use_create_analytics_form';

jest.mock('ui/index_patterns', () => ({
validateIndexPattern: () => true,
INDEX_PATTERN_ILLEGAL_CHARACTERS: [],
}));

const getMountedHook = () =>
mountHook(
() => useCreateAnalyticsForm(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ import { kibanaContextValueMock } from '../../../../../contexts/kibana/__mocks__

import { useCreateAnalyticsForm } from '../../hooks/use_create_analytics_form';

jest.mock('ui/index_patterns', () => ({
validateIndexPattern: () => true,
INDEX_PATTERN_ILLEGAL_CHARACTERS: [],
}));

const getMountedHook = () =>
mountHook(
() => useCreateAnalyticsForm(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ import { ACTION } from './actions';
import { reducer, validateAdvancedEditor } from './reducer';
import { getInitialState, JOB_TYPES } from './state';

jest.mock('ui/index_patterns', () => ({
validateIndexPattern: () => true,
}));

type SourceIndex = DataFrameAnalyticsConfig['source']['index'];

const getMockState = ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ import { kibanaContextValueMock } from '../../../../../contexts/kibana/__mocks__

import { getErrorMessage, useCreateAnalyticsForm } from './use_create_analytics_form';

jest.mock('ui/index_patterns', () => ({
validateIndexPattern: () => true,
}));

const getMountedHook = () =>
mountHook(
() => useCreateAnalyticsForm(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ import { GetDataFrameAnalyticsStatsResponseOk } from '../../../../../services/ml
import { getAnalyticsJobsStats } from './get_analytics';
import { DATA_FRAME_TASK_STATE } from '../../components/analytics_list/common';

jest.mock('ui/index_patterns', () => ({
validateIndexPattern: () => true,
}));

describe('get_analytics', () => {
test('should get analytics jobs stats', () => {
// arrange
Expand Down

0 comments on commit 981c98d

Please sign in to comment.