Files
frontend-app-ora-grading/src/setupTest.js
Diana Villalvazo a579455e58 test: Remove unwanted mocks, unmocks and deprecate react-unit-test-utils package (#465)
* test: remove last snapshot

* test: remove unwanted mocks, remove unmocks, refactor renderWithIntl

* test: refactor renderWithIntl with small improvements

* test: remove react-unit-test-utils

* test: change fireEvent for userEvent
2025-09-05 12:34:28 -04:00

29 lines
807 B
JavaScript
Executable File

/* eslint-disable import/no-extraneous-dependencies */
import '@testing-library/jest-dom';
jest.mock('data/constants/app', () => ({
locationId: () => 'fake-location-id',
}));
jest.mock('hooks', () => ({
...jest.requireActual('hooks'),
nullMethod: jest.fn().mockName('hooks.nullMethod'),
}));
jest.mock('@zip.js/zip.js', () => ({}));
// Mock react-redux hooks
// unmock for integration tests
jest.mock('react-redux', () => {
const dispatch = jest.fn((...args) => ({ dispatch: args })).mockName('react-redux.dispatch');
return {
connect: (mapStateToProps, mapDispatchToProps) => (component) => ({
mapStateToProps,
mapDispatchToProps,
component,
}),
useDispatch: jest.fn(() => dispatch),
useSelector: jest.fn((selector) => ({ useSelector: selector })),
};
});