Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import React from 'react';
import { act } from 'react-dom/test-utils';
import { registerTestBed, TestBed, TestBedConfig } from '@kbn/test/jest';
import { KibanaContextProvider } from '../../../../../../src/plugins/kibana_react/public/context';
import { KibanaContextProvider } from '../../../../../../src/plugins/kibana_react/public';
import { createBreadcrumbsMock } from '../../../public/application/services/breadcrumbs.mock';
import { licensingMock } from '../../../../licensing/public/mocks';
import { App } from '../../../public/application/app';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,17 @@
* 2.0.
*/

import { act } from 'react-dom/test-utils';

import { getDefaultHotPhasePolicy, POLICY_NAME } from '../edit_policy/constants';
import { setupEnvironment } from '../helpers';

import {
AppTestBed,
getDoubleEncodedPolicyEditPath,
getEncodedPolicyEditPath,
setup,
} from './app.helpers';
import { setupEnvironment } from '../helpers/setup_environment';
import { getDefaultHotPhasePolicy, POLICY_NAME } from '../edit_policy/constants';
import { act } from 'react-dom/test-utils';

const SPECIAL_CHARS_NAME = 'test?#$+=&@:';
const PERCENT_SIGN_NAME = 'test%';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
import { TestBedConfig } from '@kbn/test/jest';
import { AppServicesContext } from '../../../public/types';

import { Phase } from '../../../common/types';

import {
Phase,
createNodeAllocationActions,
createFormToggleAction,
createFormSetValueAction,
Expand All @@ -27,7 +28,6 @@ import {
createReadonlyActions,
createIndexPriorityActions,
} from '../helpers';

import { initTestBed } from './init_test_bed';

type SetupReturn = ReturnType<typeof setup>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
* 2.0.
*/

import { act } from 'react-dom/test-utils';
import { API_BASE_PATH } from '../../../../common/constants';
import { setupEnvironment } from '../../helpers';
import { EditPolicyTestBed, setup } from '../edit_policy.helpers';
import {
DELETE_PHASE_POLICY,
getDefaultHotPhasePolicy,
NEW_SNAPSHOT_POLICY_NAME,
SNAPSHOT_POLICY_NAME,
} from '../constants';
import { act } from 'react-dom/test-utils';
import { EditPolicyTestBed, setup } from '../edit_policy.helpers';
import { API_BASE_PATH } from '../../../../common/constants';
import { setupEnvironment } from '../../helpers/setup_environment';

describe('<EditPolicy /> delete phase', () => {
let testBed: EditPolicyTestBed;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import { act } from 'react-dom/test-utils';

import { licensingMock } from '../../../../../licensing/public/mocks';
import { setupEnvironment } from '../../helpers/setup_environment';
import { setupEnvironment } from '../../helpers';
import { EditPolicyTestBed, setup } from '../edit_policy.helpers';

describe('<EditPolicy /> frozen phase', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import { act } from 'react-dom/test-utils';
import { setupEnvironment } from '../../../helpers/setup_environment';
import { setupEnvironment } from '../../../helpers';
import {
CloudNodeAllocationTestBed,
setupCloudNodeAllocation,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import { act } from 'react-dom/test-utils';
import { setupEnvironment } from '../../../helpers/setup_environment';
import { setupEnvironment } from '../../../helpers';
import { NodeAllocationTestBed, setupColdPhaseNodeAllocation } from './cold_phase.helpers';

describe('<EditPolicy /> node allocation in the cold phase', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import { act } from 'react-dom/test-utils';
import { setupEnvironment } from '../../../helpers/setup_environment';
import { setupEnvironment } from '../../../helpers';
import {
GeneralNodeAllocationTestBed,
setupGeneralNodeAllocation,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import { act } from 'react-dom/test-utils';
import { setupEnvironment } from '../../../helpers/setup_environment';
import { setupEnvironment } from '../../../helpers';
import { NodeAllocationTestBed, setupWarmPhaseNodeAllocation } from './warm_phase.helpers';

describe('<EditPolicy /> node allocation in the warm phase', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
*/

import { act } from 'react-dom/test-utils';
import { setupEnvironment } from '../../helpers';
import { EditPolicyTestBed, setup } from '../edit_policy.helpers';
import { setupEnvironment } from '../../helpers/setup_environment';

describe('<EditPolicy /> request flyout', () => {
let testBed: EditPolicyTestBed;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import { act } from 'react-dom/test-utils';
import { licensingMock } from '../../../../../licensing/public/mocks';
import { setupEnvironment } from '../../helpers/setup_environment';
import { setupEnvironment } from '../../helpers';
import { EditPolicyTestBed, setup } from '../edit_policy.helpers';

describe('<EditPolicy /> rollover', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import { act } from 'react-dom/test-utils';
import { licensingMock } from '../../../../../licensing/public/mocks';
import { setupEnvironment } from '../../helpers/setup_environment';
import { setupEnvironment } from '../../helpers';
import { getDefaultHotPhasePolicy } from '../constants';
import { EditPolicyTestBed, setup } from '../edit_policy.helpers';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import { act } from 'react-dom/test-utils';
import { setupEnvironment } from '../../helpers/setup_environment';
import { setupEnvironment } from '../../helpers';
import { EditPolicyTestBed, setup } from '../edit_policy.helpers';

describe('<EditPolicy /> timeline', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import { act } from 'react-dom/test-utils';
import { setupEnvironment } from '../../helpers/setup_environment';
import { setupEnvironment } from '../../helpers';
import { EditPolicyTestBed, setup } from '../edit_policy.helpers';

describe('<EditPolicy /> warm phase', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import { act } from 'react-dom/test-utils';
import { i18nTexts } from '../../../../public/application/sections/edit_policy/i18n_texts';
import { setupEnvironment } from '../../helpers/setup_environment';
import { setupEnvironment } from '../../helpers';
import { EditPolicyTestBed, setup } from '../edit_policy.helpers';

describe('<EditPolicy /> cold phase validation', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import { act } from 'react-dom/test-utils';
import { setupEnvironment } from '../../helpers/setup_environment';
import { setupEnvironment } from '../../helpers';
import { EditPolicyTestBed, setup } from '../edit_policy.helpers';

describe('<EditPolicy /> error indicators', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import { act } from 'react-dom/test-utils';
import { i18nTexts } from '../../../../public/application/sections/edit_policy/i18n_texts';
import { setupEnvironment } from '../../helpers/setup_environment';
import { setupEnvironment } from '../../helpers';
import { EditPolicyTestBed, setup } from '../edit_policy.helpers';

describe('<EditPolicy /> hot phase validation', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import { act } from 'react-dom/test-utils';
import { i18nTexts } from '../../../../public/application/sections/edit_policy/i18n_texts';
import { setupEnvironment } from '../../helpers/setup_environment';
import { setupEnvironment } from '../../helpers';
import { EditPolicyTestBed, setup } from '../edit_policy.helpers';
import { getGeneratedPolicies } from '../constants';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
import { act } from 'react-dom/test-utils';
import { i18nTexts } from '../../../../public/application/sections/edit_policy/i18n_texts';

import { PhaseWithTiming } from '../../../../common/types';
import { setupEnvironment } from '../../helpers';
import { EditPolicyTestBed, setup } from '../edit_policy.helpers';
import { setupEnvironment } from '../../helpers/setup_environment';

describe('<EditPolicy /> timing validation', () => {
let testBed: EditPolicyTestBed;
Expand Down Expand Up @@ -69,12 +70,12 @@ describe('<EditPolicy /> timing validation', () => {
['warm', 'cold', 'delete', 'frozen'].forEach((phase: string) => {
const { name, value, error } = testConfig;
test(`${phase}: ${name}`, async () => {
await actions.togglePhase(phase as 'warm' | 'cold' | 'delete' | 'frozen');
await actions.togglePhase(phase as PhaseWithTiming);
// 1. We first set as dummy value to have a starting min_age value
await actions[phase as 'warm' | 'cold' | 'delete' | 'frozen'].setMinAgeValue('111');
await actions[phase as PhaseWithTiming].setMinAgeValue('111');
// 2. At this point we are sure there will be a change of value and that any validation
// will be displayed under the field.
await actions[phase as 'warm' | 'cold' | 'delete' | 'frozen'].setMinAgeValue(value);
await actions[phase as PhaseWithTiming].setMinAgeValue(value);

actions.errors.waitForValidation();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import { act } from 'react-dom/test-utils';
import { i18nTexts } from '../../../../public/application/sections/edit_policy/i18n_texts';
import { setupEnvironment } from '../../helpers/setup_environment';
import { setupEnvironment } from '../../helpers';
import { EditPolicyTestBed, setup } from '../edit_policy.helpers';

describe('<EditPolicy /> warm phase validation', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@
*/

import { act } from 'react-dom/test-utils';
import { setupEnvironment } from '../../helpers/setup_environment';
import { licensingMock } from '../../../../../licensing/public/mocks';
import { setupEnvironment } from '../../helpers';
import {
getDefaultHotPhasePolicy,
POLICY_WITH_INCLUDE_EXCLUDE,
POLICY_WITH_KNOWN_AND_UNKNOWN_FIELDS,
} from '../constants';
import { EditPolicyTestBed, setup } from '../edit_policy.helpers';
import { licensingMock } from '../../../../../licensing/public/mocks';

describe('<EditPolicy /> serialization', () => {
let testBed: EditPolicyTestBed;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import { act } from 'react-dom/test-utils';
import { TestBed } from '@kbn/test/jest';
import { Phase } from '../types';
import { Phase } from '../../../../common/types';

const createWaitForValidationAction = (testBed: TestBed) => () => {
const { component } = testBed;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@

import { act } from 'react-dom/test-utils';
import { TestBed } from '@kbn/test/jest';
import { Phase } from '../../../../common/types';
import { createFormToggleAction } from './form_toggle_action';
import { createFormSetValueAction } from './form_set_value_action';
import { Phase } from '../types';

const createFormCheckboxAction = (testBed: TestBed, dataTestSubject: string) => async (
checked: boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
*/

import { TestBed } from '@kbn/test/jest';
import { Phase } from '../../../../common/types';
import { createFormToggleAction } from './form_toggle_action';
import { Phase } from '../types';

export const createFreezeActions = (testBed: TestBed, phase: Phase) => {
const { exists } = testBed;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
*/

import { TestBed } from '@kbn/test/jest';
import { Phase } from '../../../../common/types';
import { createFormToggleAction } from './form_toggle_action';
import { createFormSetValueAction } from './form_set_value_action';
import { Phase } from '../types';

export const createIndexPriorityActions = (testBed: TestBed, phase: Phase) => {
const { exists } = testBed;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
*/

import { TestBed } from '@kbn/test/jest';
import { Phase } from '../../../../common/types';
import { createFormSetValueAction } from './form_set_value_action';
import { Phase } from '../types';

export const createMinAgeActions = (testBed: TestBed, phase: Phase) => {
const { exists } = testBed;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { act } from 'react-dom/test-utils';
import { TestBed } from '@kbn/test/jest';

import { DataTierAllocationType } from '../../../../public/application/sections/edit_policy/types';
import { Phase } from '../types';
import { Phase } from '../../../../common/types';
import { createFormSetValueAction } from './form_set_value_action';

export const createNodeAllocationActions = (testBed: TestBed, phase: Phase) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
*/

import { TestBed } from '@kbn/test/jest';
import { Phase } from '../../../../common/types';
import { createFormToggleAction } from './form_toggle_action';
import { Phase } from '../types';

export const createReadonlyActions = (testBed: TestBed, phase: Phase) => {
const { exists } = testBed;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import { act } from 'react-dom/test-utils';
import { TestBed } from '@kbn/test/jest';
import { Phase } from '../types';
import { Phase } from '../../../../common/types';
import { createFormToggleAction } from './form_toggle_action';

export const createSearchableSnapshotActions = (testBed: TestBed, phase: Phase) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import { TestBed } from '@kbn/test/jest';

import { Phase } from '../types';
import { Phase } from '../../../../common/types';
import { createFormToggleAction } from './form_toggle_action';
import { createFormSetValueAction } from './form_set_value_action';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
*/

import { TestBed } from '@kbn/test/jest';
import { Phase } from '../../../../common/types';
import { createFormToggleAction } from './form_toggle_action';
import { createFormSetValueAction } from './form_set_value_action';
import { Phase } from '../types';

export const createShrinkActions = (testBed: TestBed, phase: Phase) => {
const { exists } = testBed;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
*/

import { TestBed } from '@kbn/test/jest';

import { act } from 'react-dom/test-utils';
import { Phase } from '../types';

import { Phase } from '../../../../common/types';

const toggleDeletePhase = async (testBed: TestBed) => {
const { find, component } = testBed;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
* 2.0.
*/

export { Phase } from './types';

export * from './actions';

export { setupEnvironment } from './setup_environment';

This file was deleted.

Loading