test: Deprecate react-unit-test-utils 15/15 (#680)
This commit is contained in:
@@ -1,9 +1,6 @@
|
||||
import { render, screen } from '@testing-library/react';
|
||||
import Banner from './Banner';
|
||||
|
||||
jest.unmock('@openedx/paragon');
|
||||
jest.unmock('react');
|
||||
|
||||
describe('Banner component', () => {
|
||||
it('renders children content', () => {
|
||||
render(<Banner>Test content</Banner>);
|
||||
|
||||
@@ -5,8 +5,6 @@ import useIsCollapsed from './hooks';
|
||||
|
||||
jest.mock('./hooks', () => jest.fn());
|
||||
|
||||
jest.unmock('@openedx/paragon');
|
||||
|
||||
describe('ActionButton', () => {
|
||||
const props = {
|
||||
className: 'custom-class',
|
||||
|
||||
@@ -18,8 +18,6 @@ jest.mock('./ViewCourseButton', () => jest.fn(() => <div>ViewCourseButton</div>)
|
||||
jest.mock('./BeginCourseButton', () => jest.fn(() => <div>BeginCourseButton</div>));
|
||||
jest.mock('./ResumeButton', () => jest.fn(() => <div>ResumeButton</div>));
|
||||
|
||||
jest.unmock('@openedx/paragon');
|
||||
|
||||
const cardId = 'test-card-id';
|
||||
const props = { cardId };
|
||||
|
||||
|
||||
@@ -17,11 +17,6 @@ jest.mock('hooks', () => ({
|
||||
},
|
||||
}));
|
||||
|
||||
jest.unmock('@openedx/paragon');
|
||||
jest.unmock('@openedx/paragon/icons');
|
||||
jest.unmock('@edx/frontend-platform/i18n');
|
||||
jest.unmock('react');
|
||||
|
||||
const defaultCertificate = {
|
||||
availableDate: '10/20/3030',
|
||||
isRestricted: false,
|
||||
|
||||
@@ -17,10 +17,6 @@ jest.mock('hooks', () => ({
|
||||
},
|
||||
}));
|
||||
|
||||
jest.unmock('@openedx/paragon');
|
||||
jest.unmock('@edx/frontend-platform/i18n');
|
||||
jest.unmock('react');
|
||||
|
||||
const cardId = 'test-card-id';
|
||||
|
||||
const enrollmentData = {
|
||||
|
||||
@@ -7,10 +7,6 @@ jest.mock('./hooks', () => ({
|
||||
useCreditBannerData: jest.fn(),
|
||||
}));
|
||||
|
||||
jest.unmock('@openedx/paragon');
|
||||
jest.unmock('@edx/frontend-platform/i18n');
|
||||
jest.unmock('react');
|
||||
|
||||
describe('CreditBanner', () => {
|
||||
const mockCardId = 'test-card-id';
|
||||
const mockContentComponent = () => <div data-testid="mock-content">Test Content</div>;
|
||||
|
||||
@@ -12,10 +12,6 @@ jest.mock('hooks', () => ({
|
||||
},
|
||||
}));
|
||||
|
||||
jest.unmock('@openedx/paragon');
|
||||
jest.unmock('react');
|
||||
jest.unmock('@edx/frontend-platform/i18n');
|
||||
|
||||
const cardId = 'test-card-id';
|
||||
const credit = {
|
||||
providerStatusUrl: 'test-credit-provider-status-url',
|
||||
|
||||
@@ -21,10 +21,6 @@ jest.mock('tracking', () => ({
|
||||
},
|
||||
}));
|
||||
|
||||
jest.unmock('@edx/frontend-platform/i18n');
|
||||
jest.unmock('@openedx/paragon');
|
||||
jest.unmock('react');
|
||||
|
||||
const cardId = 'test-card-id';
|
||||
const courseId = 'test-course-id';
|
||||
const credit = {
|
||||
|
||||
@@ -18,10 +18,6 @@ jest.mock('hooks', () => ({
|
||||
},
|
||||
}));
|
||||
|
||||
jest.unmock('@openedx/paragon');
|
||||
jest.unmock('@edx/frontend-platform/i18n');
|
||||
jest.unmock('react');
|
||||
|
||||
const cardId = 'test-card-id';
|
||||
const requestData = {
|
||||
url: 'test-request-data-url',
|
||||
|
||||
@@ -10,10 +10,6 @@ jest.mock('hooks', () => ({
|
||||
reduxHooks: { useCardCreditData: jest.fn(), useMasqueradeData: jest.fn() },
|
||||
}));
|
||||
|
||||
jest.unmock('@edx/frontend-platform/i18n');
|
||||
jest.unmock('@openedx/paragon');
|
||||
jest.unmock('react');
|
||||
|
||||
const cardId = 'test-card-id';
|
||||
const providerName = 'test-credit-provider-name';
|
||||
const providerStatusUrl = 'test-credit-provider-status-url';
|
||||
|
||||
@@ -10,10 +10,6 @@ jest.mock('hooks', () => ({
|
||||
},
|
||||
}));
|
||||
|
||||
jest.unmock('@openedx/paragon');
|
||||
jest.unmock('@edx/frontend-platform/i18n');
|
||||
jest.unmock('react');
|
||||
|
||||
const cardId = 'test-card-id';
|
||||
const credit = {
|
||||
providerStatusUrl: 'test-credit-provider-status-url',
|
||||
|
||||
@@ -2,9 +2,6 @@ import { render, screen } from '@testing-library/react';
|
||||
|
||||
import CreditContent from './CreditContent';
|
||||
|
||||
jest.unmock('@openedx/paragon');
|
||||
jest.unmock('react');
|
||||
|
||||
const action = {
|
||||
href: 'test-action-href',
|
||||
onClick: jest.fn().mockName('test-action-onClick'),
|
||||
|
||||
@@ -10,9 +10,6 @@ jest.mock('./hooks', () => ({
|
||||
default: jest.fn(),
|
||||
}));
|
||||
|
||||
jest.unmock('@openedx/paragon');
|
||||
jest.unmock('react');
|
||||
|
||||
const ref = { current: { click: jest.fn() }, useRef: jest.fn() };
|
||||
|
||||
const requestData = {
|
||||
|
||||
@@ -4,9 +4,6 @@ import { render } from '@testing-library/react';
|
||||
import useCreditRequestFormData from './hooks';
|
||||
import CreditRequestForm from '.';
|
||||
|
||||
jest.unmock('@openedx/paragon');
|
||||
jest.unmock('react');
|
||||
|
||||
jest.mock('./hooks', () => ({
|
||||
__esModule: true,
|
||||
default: jest.fn(),
|
||||
|
||||
@@ -10,10 +10,6 @@ jest.mock('hooks', () => ({
|
||||
},
|
||||
}));
|
||||
|
||||
jest.unmock('@openedx/paragon');
|
||||
jest.unmock('@edx/frontend-platform/i18n');
|
||||
jest.unmock('react');
|
||||
|
||||
const cardId = 'test-card-id';
|
||||
const credit = {
|
||||
providerStatusUrl: 'test-credit-provider-status-url',
|
||||
|
||||
@@ -19,10 +19,6 @@ jest.mock('hooks', () => ({
|
||||
},
|
||||
}));
|
||||
|
||||
jest.unmock('@edx/frontend-platform/i18n');
|
||||
jest.unmock('@openedx/paragon');
|
||||
jest.unmock('react');
|
||||
|
||||
const cardId = 'test-card-id';
|
||||
|
||||
const entitlementData = {
|
||||
|
||||
@@ -4,11 +4,6 @@ import { IntlProvider } from '@edx/frontend-platform/i18n';
|
||||
import { reduxHooks } from 'hooks';
|
||||
import RelatedProgramsBanner from '.';
|
||||
|
||||
jest.unmock('@openedx/paragon');
|
||||
jest.unmock('@openedx/paragon/icons');
|
||||
jest.unmock('@edx/frontend-platform/i18n');
|
||||
jest.unmock('react');
|
||||
|
||||
jest.mock('hooks', () => ({
|
||||
reduxHooks: {
|
||||
useCardRelatedProgramsData: jest.fn(),
|
||||
|
||||
@@ -6,10 +6,6 @@ import useActionDisabledState from './hooks';
|
||||
import { CourseCardImage } from './CourseCardImage';
|
||||
import messages from '../messages';
|
||||
|
||||
jest.unmock('@edx/frontend-platform/i18n');
|
||||
jest.unmock('@openedx/paragon');
|
||||
jest.unmock('react');
|
||||
|
||||
const homeUrl = 'https://example.com';
|
||||
const bannerImgSrc = 'banner-img-src.jpg';
|
||||
|
||||
|
||||
@@ -27,10 +27,6 @@ jest.mock('./hooks', () => ({
|
||||
useEmailSettings: jest.fn(),
|
||||
}));
|
||||
|
||||
jest.unmock('@edx/frontend-platform/i18n');
|
||||
jest.unmock('@openedx/paragon');
|
||||
jest.unmock('react');
|
||||
|
||||
const props = {
|
||||
cardId: 'test-card-id',
|
||||
emailSettings: { show: jest.fn() },
|
||||
|
||||
@@ -25,10 +25,6 @@ jest.mock('./hooks', () => ({
|
||||
useOptionVisibility: jest.fn(),
|
||||
}));
|
||||
|
||||
jest.unmock('@edx/frontend-platform/i18n');
|
||||
jest.unmock('@openedx/paragon');
|
||||
jest.unmock('react');
|
||||
|
||||
const props = {
|
||||
cardId: 'test-card-id',
|
||||
};
|
||||
|
||||
@@ -21,10 +21,6 @@ jest.mock('hooks', () => ({
|
||||
|
||||
jest.mock('./hooks', () => jest.fn(() => ({ disableCourseTitle: false })));
|
||||
|
||||
jest.unmock('@edx/frontend-platform/i18n');
|
||||
jest.unmock('@openedx/paragon');
|
||||
jest.unmock('react');
|
||||
|
||||
describe('CourseCardTitle', () => {
|
||||
const props = {
|
||||
cardId: 'test-card-id',
|
||||
|
||||
@@ -7,10 +7,6 @@ import RelatedProgramsBadge from '.';
|
||||
jest.mock('containers/RelatedProgramsModal', () => 'RelatedProgramsModal');
|
||||
jest.mock('./hooks', () => jest.fn());
|
||||
|
||||
jest.unmock('@edx/frontend-platform/i18n');
|
||||
jest.unmock('@openedx/paragon');
|
||||
jest.unmock('react');
|
||||
|
||||
const hookProps = {
|
||||
isOpen: true,
|
||||
openModal: jest.fn().mockName('useRelatedProgramsBadge.openModal'),
|
||||
|
||||
@@ -24,10 +24,6 @@ jest.mock('./components/CourseCardActions', () => jest.fn(() => <div>CourseCardA
|
||||
jest.mock('./components/CourseCardDetails', () => jest.fn(() => <div>CourseCardDetails</div>));
|
||||
jest.mock('./components/CourseCardTitle', () => jest.fn(() => <div>CourseCardTitle</div>));
|
||||
|
||||
jest.unmock('@edx/frontend-platform/i18n');
|
||||
jest.unmock('@openedx/paragon');
|
||||
jest.unmock('react');
|
||||
|
||||
const cardId = 'test-card-id';
|
||||
|
||||
describe('CourseCard component', () => {
|
||||
|
||||
@@ -6,10 +6,6 @@ import { FilterKeys } from 'data/constants/app';
|
||||
import ActiveCourseFilters from './ActiveCourseFilters';
|
||||
import messages from './messages';
|
||||
|
||||
jest.unmock('@edx/frontend-platform/i18n');
|
||||
jest.unmock('@openedx/paragon');
|
||||
jest.unmock('react');
|
||||
|
||||
const filters = Object.values(FilterKeys);
|
||||
|
||||
describe('ActiveCourseFilters', () => {
|
||||
|
||||
@@ -15,10 +15,6 @@ jest.mock('hooks', () => ({
|
||||
|
||||
jest.mock('./hooks', () => jest.fn());
|
||||
|
||||
jest.unmock('@edx/frontend-platform/i18n');
|
||||
jest.unmock('@openedx/paragon');
|
||||
jest.unmock('react');
|
||||
|
||||
jest.mock('@openedx/paragon', () => ({
|
||||
...jest.requireActual('@openedx/paragon'),
|
||||
useWindowSize: jest.fn(),
|
||||
|
||||
@@ -6,10 +6,6 @@ import { FilterKeys } from 'data/constants/app';
|
||||
import Checkbox from './Checkbox';
|
||||
import messages from '../messages';
|
||||
|
||||
jest.unmock('@edx/frontend-platform/i18n');
|
||||
jest.unmock('@openedx/paragon');
|
||||
jest.unmock('react');
|
||||
|
||||
describe('Checkbox', () => {
|
||||
describe('renders correctly', () => {
|
||||
Object.keys(FilterKeys).forEach((filterKey) => {
|
||||
|
||||
@@ -5,10 +5,6 @@ import { FilterKeys } from 'data/constants/app';
|
||||
import { FilterForm, filterOrder } from './FilterForm';
|
||||
import messages from '../messages';
|
||||
|
||||
jest.unmock('@edx/frontend-platform/i18n');
|
||||
jest.unmock('@openedx/paragon');
|
||||
jest.unmock('react');
|
||||
|
||||
const mockHandleFilterChange = jest.fn();
|
||||
|
||||
const defaultProps = {
|
||||
|
||||
@@ -6,10 +6,6 @@ import { SortKeys } from 'data/constants/app';
|
||||
import SortForm from './SortForm';
|
||||
import messages from '../messages';
|
||||
|
||||
jest.unmock('@edx/frontend-platform/i18n');
|
||||
jest.unmock('@openedx/paragon');
|
||||
jest.unmock('react');
|
||||
|
||||
describe('SortForm', () => {
|
||||
const props = {
|
||||
handleSortChange: jest.fn().mockName('handleSortChange'),
|
||||
|
||||
@@ -12,10 +12,6 @@ jest.mock('containers/CourseFilterControls', () => ({
|
||||
ActiveCourseFilters: jest.fn(() => <div>ActiveCourseFilters</div>),
|
||||
}));
|
||||
|
||||
jest.unmock('@edx/frontend-platform/i18n');
|
||||
jest.unmock('@openedx/paragon');
|
||||
jest.unmock('react');
|
||||
|
||||
describe('CourseList', () => {
|
||||
const defaultCourseListData = {
|
||||
filterOptions: {},
|
||||
|
||||
@@ -16,10 +16,6 @@ jest.mock('hooks', () => ({
|
||||
},
|
||||
}));
|
||||
|
||||
jest.unmock('@edx/frontend-platform/i18n');
|
||||
jest.unmock('@openedx/paragon');
|
||||
jest.unmock('react');
|
||||
|
||||
describe('NoCoursesView', () => {
|
||||
it('should display image, heading and button', () => {
|
||||
render(<IntlProvider locale="en"><EmptyCourse /></IntlProvider>);
|
||||
|
||||
@@ -33,10 +33,6 @@ jest.mock('@openedx/frontend-plugin-framework', () => ({
|
||||
PluginSlot: 'PluginSlot',
|
||||
}));
|
||||
|
||||
jest.unmock('@edx/frontend-platform/i18n');
|
||||
jest.unmock('@openedx/paragon');
|
||||
jest.unmock('react');
|
||||
|
||||
const filters = Object.values(FilterKeys);
|
||||
|
||||
reduxHooks.useHasCourses.mockReturnValue(true);
|
||||
|
||||
@@ -12,10 +12,6 @@ jest.mock('@openedx/frontend-plugin-framework', () => ({
|
||||
PluginSlot: 'PluginSlot',
|
||||
}));
|
||||
|
||||
jest.unmock('@edx/frontend-platform/i18n');
|
||||
jest.unmock('@openedx/paragon');
|
||||
jest.unmock('react');
|
||||
|
||||
const hookProps = {
|
||||
isCollapsed: true,
|
||||
sidebarShowing: false,
|
||||
|
||||
@@ -7,10 +7,6 @@ jest.mock('./hooks', () => ({
|
||||
useDashboardMessages: jest.fn(),
|
||||
}));
|
||||
|
||||
jest.unmock('@edx/frontend-platform/i18n');
|
||||
jest.unmock('@openedx/paragon');
|
||||
jest.unmock('react');
|
||||
|
||||
const spinnerScreenReaderText = 'test-sr-text';
|
||||
describe('LoadingView', () => {
|
||||
it('renders spinner component with associated screen reader text', () => {
|
||||
|
||||
@@ -10,10 +10,6 @@ jest.mock('./hooks', () => ({
|
||||
default: jest.fn(),
|
||||
}));
|
||||
|
||||
jest.unmock('@edx/frontend-platform/i18n');
|
||||
jest.unmock('@openedx/paragon');
|
||||
jest.unmock('react');
|
||||
|
||||
const hookProps = {
|
||||
isOptedOut: true,
|
||||
onToggle: jest.fn().mockName('hooks.onToggle'),
|
||||
|
||||
@@ -10,10 +10,6 @@ jest.mock('./hooks', () => ({
|
||||
default: jest.fn(),
|
||||
}));
|
||||
|
||||
jest.unmock('@openedx/paragon');
|
||||
jest.unmock('@edx/frontend-platform/i18n');
|
||||
jest.unmock('react');
|
||||
|
||||
const hookProps = {
|
||||
isNeeded: true,
|
||||
showPageBanner: jest.fn().mockName('showPageBanner'),
|
||||
|
||||
@@ -20,10 +20,6 @@ jest.mock('./hooks', () => ({
|
||||
findCoursesNavClicked: jest.fn(),
|
||||
}));
|
||||
|
||||
jest.unmock('@openedx/paragon');
|
||||
jest.unmock('@edx/frontend-platform/i18n');
|
||||
jest.unmock('react');
|
||||
|
||||
const mockedHeaderProps = jest.fn();
|
||||
jest.mock('containers/MasqueradeBar', () => jest.fn(() => <div>MasqueradeBar</div>));
|
||||
jest.mock('./ConfirmEmailBanner', () => jest.fn(() => <div>ConfirmEmailBanner</div>));
|
||||
|
||||
@@ -9,10 +9,6 @@ jest.mock('./hooks', () => ({
|
||||
useMasqueradeBarData: jest.fn(),
|
||||
}));
|
||||
|
||||
jest.unmock('@openedx/paragon');
|
||||
jest.unmock('@edx/frontend-platform/i18n');
|
||||
jest.unmock('react');
|
||||
|
||||
describe('MasqueradeBar', () => {
|
||||
const masqueradeMockData = {
|
||||
canMasquerade: true,
|
||||
|
||||
@@ -16,10 +16,6 @@ const props = {
|
||||
},
|
||||
};
|
||||
|
||||
jest.unmock('@openedx/paragon');
|
||||
jest.unmock('@edx/frontend-platform/i18n');
|
||||
jest.unmock('react');
|
||||
|
||||
describe('RelatedProgramsModal ProgramCard', () => {
|
||||
describe('renders', () => {
|
||||
beforeEach(() => render(<IntlProvider locale="en"><ProgramCard {...props} /></IntlProvider>));
|
||||
|
||||
@@ -13,10 +13,6 @@ jest.mock('hooks', () => ({
|
||||
},
|
||||
}));
|
||||
|
||||
jest.unmock('@openedx/paragon');
|
||||
jest.unmock('@edx/frontend-platform/i18n');
|
||||
jest.unmock('react');
|
||||
|
||||
const cardId = 'test-card-id';
|
||||
const courseData = {
|
||||
courseName: 'test course',
|
||||
|
||||
@@ -10,10 +10,6 @@ jest.mock('./hooks', () => ({
|
||||
default: jest.fn(),
|
||||
}));
|
||||
|
||||
jest.unmock('@edx/frontend-platform/i18n');
|
||||
jest.unmock('@openedx/paragon');
|
||||
jest.unmock('react');
|
||||
|
||||
const hookReturn = {
|
||||
availableSessions: [],
|
||||
showModal: true,
|
||||
|
||||
@@ -5,10 +5,6 @@ import { IntlProvider } from '@edx/frontend-platform/i18n';
|
||||
import { ConfirmPane } from './ConfirmPane';
|
||||
import messages from './messages';
|
||||
|
||||
jest.unmock('@edx/frontend-platform/i18n');
|
||||
jest.unmock('@openedx/paragon');
|
||||
jest.unmock('react');
|
||||
|
||||
const props = {
|
||||
handleClose: jest.fn().mockName('props.handleClose'),
|
||||
handleConfirm: jest.fn().mockName('props.handleConfirm'),
|
||||
|
||||
@@ -5,10 +5,6 @@ import { IntlProvider } from '@edx/frontend-platform/i18n';
|
||||
import { FinishedPane } from './FinishedPane';
|
||||
import messages from './messages';
|
||||
|
||||
jest.unmock('@edx/frontend-platform/i18n');
|
||||
jest.unmock('@openedx/paragon');
|
||||
jest.unmock('react');
|
||||
|
||||
const props = {
|
||||
gaveReason: true,
|
||||
handleClose: jest.fn().mockName('props.handleClose'),
|
||||
|
||||
@@ -5,10 +5,6 @@ import { IntlProvider } from '@edx/frontend-platform/i18n';
|
||||
import { ReasonPane } from './ReasonPane';
|
||||
import messages from './messages';
|
||||
|
||||
jest.unmock('@edx/frontend-platform/i18n');
|
||||
jest.unmock('@openedx/paragon');
|
||||
jest.unmock('react');
|
||||
|
||||
describe('UnenrollConfirmModal ReasonPane', () => {
|
||||
const props = {
|
||||
reason: {
|
||||
|
||||
@@ -13,10 +13,6 @@ jest.mock('./hooks', () => ({
|
||||
useUnenrollData: jest.fn(),
|
||||
}));
|
||||
|
||||
jest.unmock('@edx/frontend-platform/i18n');
|
||||
jest.unmock('@openedx/paragon');
|
||||
jest.unmock('react');
|
||||
|
||||
describe('UnenrollConfirmModal component', () => {
|
||||
const hookProps = {
|
||||
confirm: jest.fn().mockName('hooks.confirm'),
|
||||
|
||||
@@ -4,10 +4,6 @@ import { IntlProvider } from '@edx/frontend-platform/i18n';
|
||||
import { reduxHooks } from 'hooks';
|
||||
import WidgetSidebarSlot from '.';
|
||||
|
||||
jest.unmock('react');
|
||||
jest.unmock('@edx/frontend-platform/i18n');
|
||||
jest.unmock('@openedx/paragon');
|
||||
|
||||
jest.mock('hooks', () => ({
|
||||
reduxHooks: {
|
||||
usePlatformSettingsData: jest.fn(),
|
||||
|
||||
@@ -32,11 +32,8 @@ import App from 'App';
|
||||
import Inspector from './inspector';
|
||||
import appMessages from './messages';
|
||||
|
||||
jest.unmock('@openedx/paragon');
|
||||
jest.unmock('@openedx/paragon/icons');
|
||||
jest.unmock('@edx/frontend-platform/i18n');
|
||||
jest.unmock('@edx/frontend-component-footer');
|
||||
jest.unmock('react');
|
||||
|
||||
jest.unmock('react-redux');
|
||||
jest.unmock('reselect');
|
||||
jest.unmock('hooks');
|
||||
|
||||
@@ -17,11 +17,6 @@ jest.mock('./track', () => ({
|
||||
findCoursesWidgetClicked: (href) => jest.fn().mockName(`track.findCoursesWidgetClicked('${href}')`),
|
||||
}));
|
||||
|
||||
jest.unmock('@openedx/paragon');
|
||||
jest.unmock('@openedx/paragon/icons');
|
||||
jest.unmock('@edx/frontend-platform/i18n');
|
||||
jest.unmock('react');
|
||||
|
||||
describe('LookingForChallengeWidget', () => {
|
||||
describe('render', () => {
|
||||
it('card image', () => {
|
||||
|
||||
Reference in New Issue
Block a user