test: Deprecate react-unit-test-utils 15/15 (#680)

This commit is contained in:
Diana Villalvazo
2025-07-02 10:23:55 -06:00
committed by GitHub
parent 517b8424b3
commit 6de409d7cc
47 changed files with 1 additions and 183 deletions

View File

@@ -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>);

View File

@@ -5,8 +5,6 @@ import useIsCollapsed from './hooks';
jest.mock('./hooks', () => jest.fn());
jest.unmock('@openedx/paragon');
describe('ActionButton', () => {
const props = {
className: 'custom-class',

View File

@@ -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 };

View File

@@ -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,

View File

@@ -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 = {

View File

@@ -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>;

View File

@@ -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',

View File

@@ -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 = {

View File

@@ -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',

View File

@@ -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';

View File

@@ -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',

View File

@@ -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'),

View File

@@ -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 = {

View File

@@ -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(),

View File

@@ -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',

View File

@@ -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 = {

View File

@@ -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(),

View File

@@ -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';

View File

@@ -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() },

View File

@@ -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',
};

View File

@@ -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',

View File

@@ -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'),

View File

@@ -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', () => {

View File

@@ -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', () => {

View File

@@ -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(),

View File

@@ -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) => {

View File

@@ -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 = {

View File

@@ -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'),

View File

@@ -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: {},

View File

@@ -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>);

View File

@@ -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);

View File

@@ -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,

View File

@@ -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', () => {

View File

@@ -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'),

View File

@@ -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'),

View File

@@ -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>));

View File

@@ -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,

View File

@@ -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>));

View File

@@ -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',

View File

@@ -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,

View File

@@ -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'),

View File

@@ -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'),

View File

@@ -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: {

View File

@@ -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'),

View File

@@ -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(),

View File

@@ -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');

View File

@@ -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', () => {