Skip to content

Commit

Permalink
Fixes #37636 - remove "@theforeman/test" imports
Browse files Browse the repository at this point in the history
  • Loading branch information
MariaAga committed Jul 9, 2024
1 parent 7878a4a commit ce4011b
Show file tree
Hide file tree
Showing 86 changed files with 88 additions and 92 deletions.
2 changes: 1 addition & 1 deletion webpack/assets/javascripts/react_app/common/HOC.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { mount } from '@theforeman/test';
import { mount } from 'enzyme';

import { callOnMount, withRenderHandler, callOnPopState } from './HOC';

Expand Down
5 changes: 2 additions & 3 deletions webpack/assets/javascripts/react_app/common/testHelpers.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import React from 'react';
import { shallow } from '@theforeman/test';

jest.useFakeTimers();
import { shallow } from 'enzyme';

export default {
mockStorage: () => {
Expand Down Expand Up @@ -80,6 +78,7 @@ const resolveDispatch = async (action, depth) => {
if (depth && typeof action === 'function') {
const dispatch = jest.fn();
await action(dispatch);
jest.useFakeTimers();
jest.runOnlyPendingTimers();

return Promise.all(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react';
import { render, fireEvent, screen, act } from '@testing-library/react';
import { mount } from '@theforeman/test';

import { testComponentSnapshotsWithFixtures } from '../../../common/testHelpers';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { shallow } from '@theforeman/test';
import { shallow } from 'enzyme';
import React from 'react';
import ChartBox from './ChartBox';
import { classFunctionUnitTest } from '../../common/testHelpers';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { shallow } from '@theforeman/test';
import { shallow } from 'enzyme';
import React from 'react';
import ConfigReports from './ConfigReports';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { mount } from '@theforeman/test';
import { mount } from 'enzyme';

import { testComponentSnapshotsWithFixtures } from '../../../../common/testHelpers';
import DiffModal from '../DiffModal';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { Provider } from 'react-redux';
import { mount } from '@theforeman/test';
import { mount } from 'enzyme';
import { Button } from '@patternfly/react-core';
import store from '../../redux';
import ConfirmModal, { openConfirmModal } from './index';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { mount } from '@theforeman/test';
import { mount } from 'enzyme';
import { testComponentSnapshotsWithFixtures } from '../../../common/testHelpers';
import Editor from '../Editor';
import { editorOptions } from '../Editor.fixtures';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { mount } from '@theforeman/test';
import { mount } from 'enzyme';
import { testComponentSnapshotsWithFixtures } from '../../../../common/testHelpers';

import EditorNavbar from '../EditorNavbar';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { mount } from '@theforeman/test';
import { mount } from 'enzyme';
import { testComponentSnapshotsWithFixtures } from '../../../../common/testHelpers';

import EditorOptions from '../EditorOptions';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
import { testComponentSnapshotsWithFixtures } from 'foremanReact/common/testHelpers';
import ExternalLogout from '../ExternalLogout';
import { props } from '../ExternalLogout.fixtures';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
import { testComponentSnapshotsWithFixtures } from 'foremanReact/common/testHelpers';

import SubmitOrCancel from './SubmitOrCancel';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { shallow } from '@theforeman/test';
import { shallow } from 'enzyme';
import { Button, Modal } from 'patternfly-react';
import ForemanModalFooter from '../ForemanModalFooter';
import * as ModalContext from '../../ForemanModalHooks'; // so enzyme test works
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { shallow } from '@theforeman/test';
import { shallow } from 'enzyme';
import { Modal } from 'patternfly-react';
import ForemanModalHeader from '../ForemanModalHeader';
import * as ModalContext from '../../ForemanModalHooks'; // so enzyme test works
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
import { testComponentSnapshotsWithFixtures } from 'foremanReact/common/testHelpers';

import ImpersonateIcon from './ImpersonateIcon';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
import { testComponentSnapshotsWithFixtures } from 'foremanReact/common/testHelpers';
import { hasTaxonomiesMock } from '../../Layout.fixtures';
import { noop } from '../../../../common/helpers';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { mount } from '@theforeman/test';
import { mount } from 'enzyme';
import { Provider } from 'react-redux';
import { MEGABYTES } from '../constants';
import MemoryAllocationInput from '../';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
import React from 'react';
import { Provider } from 'react-redux';
import store from '../../../../redux';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { shallow } from '@theforeman/test';
import { shallow } from 'enzyme';
import React from 'react';
import Link from './index';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { mount } from '@theforeman/test';
import { mount } from 'enzyme';

import { testComponentSnapshotsWithFixtures } from '../../../common/testHelpers';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { testReducerSnapshotWithFixtures } from '@theforeman/test';
import { testReducerSnapshotWithFixtures } from 'foremanReact/common/testHelpers';

import { default as reducer, initialState } from '../SettingRecordsReducer';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { testSelectorsSnapshotWithFixtures } from '@theforeman/test';
import { testSelectorsSnapshotWithFixtures } from 'foremanReact/common/testHelpers';

import {
selectSettings,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
import { testComponentSnapshotsWithFixtures } from 'foremanReact/common/testHelpers';

import { arraySetting } from '../SettingRecords/__tests__/SettingRecords.fixtures';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
import { testComponentSnapshotsWithFixtures } from 'foremanReact/common/testHelpers';

import SettingValueField from './SettingValueField';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
import { testComponentSnapshotsWithFixtures } from 'foremanReact/common/testHelpers';

import { groupedSettings } from '../../SettingRecords/__tests__/SettingRecords.fixtures';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
import { testComponentSnapshotsWithFixtures } from 'foremanReact/common/testHelpers';

import {
rootPass,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
import { testComponentSnapshotsWithFixtures } from 'foremanReact/common/testHelpers';

import {
rootPass,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { Provider } from 'react-redux';
import { mount } from '@theforeman/test';
import { mount } from 'enzyme';

import store from '../../../redux';
import ToastsList, { addToast, deleteToast } from '../index'
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
import { testComponentSnapshotsWithFixtures } from 'foremanReact/common/testHelpers';
import { ActionButtons } from './ActionButtons';
import { buttons } from './ActionButtons.fixtures';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { shallow } from '@theforeman/test';
import { shallow } from 'enzyme';
import React from 'react';

import AlertBody from './AlertBody';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { shallow } from '@theforeman/test';
import { shallow } from 'enzyme';
import React from 'react';

import AlertLink from './AlertLink';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { shallow } from '@theforeman/test';
import { shallow } from 'enzyme';
import React from 'react';
import componentRegistry from '../../componentRegistry';
import ComponentWrapper from './ComponentWrapper';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { shallow, mount } from '@theforeman/test';
import { shallow, mount } from 'enzyme';
import DateInput from './DateInput';

test('DateInput is working properly', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { shallow } from '@theforeman/test';
import { shallow } from 'enzyme';
import Day from './Day';

test('Day is working properly', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { shallow, mount } from '@theforeman/test';
import { shallow, mount } from 'enzyme';
import DecadeView from './DecadeView';

test('DecadeView is working properly', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { shallow } from '@theforeman/test';
import { shallow } from 'enzyme';
import { DecadeViewHeader } from './DecadeViewHeader';

test('DecadeViewHeader is working properly', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { shallow } from '@theforeman/test';
import { shallow } from 'enzyme';
import { DecadeViewTable } from './DecadeViewTable';

test('DecadeViewTable is working properly', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { shallow } from '@theforeman/test';
import { shallow } from 'enzyme';
import Header from './Header';

test('Header is working properly', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { shallow } from '@theforeman/test';
import { shallow } from 'enzyme';
import MonthView from './MonthView';

test('MonthView is working properly', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { shallow } from '@theforeman/test';
import { shallow } from 'enzyme';
import TodayButton from './TodayButton';

const mockedDate = new Date('2/21/2019 , 3:22:31 PM');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { shallow } from '@theforeman/test';
import { shallow } from 'enzyme';
import YearView from './YearView';

test('YearView is working properly', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { mount } from '@theforeman/test';
import { mount } from 'enzyme';
import DatePicker from './DatePicker';

describe('DatePicker', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { mount } from '@theforeman/test';
import { mount } from 'enzyme';
import DateTimePicker from './DateTimePicker';

describe('DateTimePicker', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { shallow, mount } from '@theforeman/test';
import { shallow, mount } from 'enzyme';
import PickTimeClock from './PickTimeClock';
import { MINUTE, HOUR } from './TimeConstants';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { shallow } from '@theforeman/test';
import { shallow } from 'enzyme';
import PickTimeTable from './PickTimeTable';
import { MINUTE, HOUR } from './TimeConstants';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { shallow, mount } from '@theforeman/test';
import { shallow, mount } from 'enzyme';
import TimeInput from './TimeInput';

test('TimeInput is working properly', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { mount } from '@theforeman/test';
import { mount } from 'enzyme';
import TimePicker from './TimePicker';

test('TimePicker is working properly', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { shallow } from '@theforeman/test';
import { shallow } from 'enzyme';
import React from 'react';
import Link from './index';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { testReducerSnapshotWithFixtures } from '@theforeman/test';
import { testReducerSnapshotWithFixtures } from 'foremanReact/common/testHelpers';
import Immutable from 'seamless-immutable';
import reducer from '../FillReducer';
import { REMOVE_FILLED_COMPONENT } from '../FillConstants';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { shallow, mount } from '@theforeman/test';
import { shallow, mount } from 'enzyme';
import React from 'react';

import { STATUS } from '../../../constants';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { shallow } from '@theforeman/test';
import { shallow } from 'enzyme';
import React from 'react';

import MessageBox from './index';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { shallow } from '@theforeman/test';
import { shallow } from 'enzyme';
import ModalProgressBar from '../ModalProgressBar';

describe('ModalProgressBar', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';

import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
import { testComponentSnapshotsWithFixtures } from 'foremanReact/common/testHelpers';

import RedirectCancelButton from './RedirectCancelButton';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { shallow, mount } from '@theforeman/test';
import { shallow, mount } from 'enzyme';
import React from 'react';
import SearchInput from './';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
import { testComponentSnapshotsWithFixtures } from 'foremanReact/common/testHelpers';
import SkeletonLoader from '.';
import { STATUS } from '../../../constants';
const fixtures = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { shallow } from '@theforeman/test';
import { shallow } from 'enzyme';
import React from 'react';
import BarChart from './';
import * as chartService from '../../../../../services/charts/BarChartService';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { shallow } from '@theforeman/test';
import { shallow } from 'enzyme';
import React from 'react';
import { mockData, emptyData } from './DonutChart.fixtures';
import DonutChart from './';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { testComponentSnapshotsWithFixtures } from '@theforeman/test';
import { testComponentSnapshotsWithFixtures } from 'foremanReact/common/testHelpers';
import { data, timeseriesData } from './LineChart.fixtures';
import LineChart from './index';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable promise/prefer-await-to-then */
// Configure Enzyme
import { mount } from '@theforeman/test';
import { mount } from 'enzyme';
import React from 'react';
import IsoDate from './IsoDate';
import { i18nProviderWrapperFactory } from '../../../common/i18nProviderWrapperFactory';
Expand Down
Loading

0 comments on commit ce4011b

Please sign in to comment.