React query and react context conversion (#786)

Migrate from Redux to React Query and React Context.  This modernizes state management while maintaining all existing functionality.  All the redux code and files were removed, including all redux and related packages.
This commit is contained in:
Jacobo Dominguez
2026-03-03 09:45:57 -06:00
committed by GitHub
parent f1180bffde
commit 0d2eb96c86
186 changed files with 9104 additions and 5899 deletions

View File

@@ -1,16 +1,16 @@
import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { IntlProvider } from '@edx/frontend-platform/i18n';
import { useSelectSessionModal } from 'data/context';
import { reduxHooks } from 'hooks';
import useActionDisabledState from '../hooks';
import SelectSessionButton from './SelectSessionButton';
jest.mock('hooks', () => ({
reduxHooks: {
useUpdateSelectSessionModalCallback: jest.fn(),
},
jest.mock('data/context', () => ({
useSelectSessionModal: jest.fn().mockReturnValue({
updateSelectSessionModal: jest.fn(),
}),
}));
jest.mock('../hooks', () => jest.fn(() => ({ disableSelectSession: false })));
@@ -33,11 +33,15 @@ describe('SelectSessionButton', () => {
});
describe('on click', () => {
it('should call openSessionModal', async () => {
const mockedUpdateSelectSessionModal = jest.fn();
useSelectSessionModal.mockReturnValue({
updateSelectSessionModal: mockedUpdateSelectSessionModal,
});
render(<IntlProvider locale="en"><SelectSessionButton {...props} /></IntlProvider>);
const user = userEvent.setup();
const button = screen.getByRole('button', { name: 'Select Session' });
await user.click(button);
expect(reduxHooks.useUpdateSelectSessionModalCallback).toHaveBeenCalledWith(props.cardId);
expect(mockedUpdateSelectSessionModal).toHaveBeenCalledWith(props.cardId);
});
});
});