Skip to content

Commit

Permalink
fix: fixed failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
katrinan029 committed Dec 10, 2024
1 parent 3847a98 commit 368dfe2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ jest.mock('@tanstack/react-query', () => ({
useQueryClient: jest.fn(),
}));
jest.mock('../../../data/services/LmsApiService');
jest.mock('../../learner-credit-management/data/hooks/useEnterpriseLearnersTableData', () => ({
...jest.requireActual('../../learner-credit-management/data/hooks/useEnterpriseLearnersTableData'),
jest.mock('../data/hooks/useEnterpriseLearnersTableData', () => ({
...jest.requireActual('../data/hooks/useEnterpriseLearnersTableData'),
useEnterpriseLearnersTableData: jest.fn(),
useGetAllEnterpriseLearnerEmails: jest.fn(),
}));
Expand Down Expand Up @@ -176,7 +176,7 @@ describe('<CreateGroupModal />', () => {
}, { timeout: EMAIL_ADDRESSES_INPUT_VALUE_DEBOUNCE_DELAY + 1000 });

// testing interaction with adding members from the datatable
const membersCheckbox = screen.getAllByTitle('Toggle Row Selected');
const membersCheckbox = screen.getAllByTitle('Toggle row selected');
userEvent.click(membersCheckbox[0]);
userEvent.click(membersCheckbox[1]);
const addMembersButton = screen.getByText('Add');
Expand Down
10 changes: 9 additions & 1 deletion src/components/PeopleManagement/tests/GroupDetailPage.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ import thunk from 'redux-thunk';
import configureMockStore from 'redux-mock-store';
import { Provider } from 'react-redux';
import userEvent from '@testing-library/user-event';
import { QueryClientProvider } from '@tanstack/react-query';

import { IntlProvider } from '@edx/frontend-platform/i18n';
import { useEnterpriseGroupUuid, useEnterpriseGroupLearnersTableData } from '../data/hooks';
import GroupDetailPage from '../GroupDetailPage/GroupDetailPage';
import LmsApiService from '../../../data/services/LmsApiService';
import { queryClient } from '../../test/testUtils';

const TEST_ENTERPRISE_SLUG = 'test-enterprise';
const enterpriseUUID = '1234';
Expand All @@ -23,6 +25,10 @@ const TEST_GROUP = {
const mockStore = configureMockStore([thunk]);
const getMockStore = store => mockStore(store);

jest.mock('@tanstack/react-query', () => ({
...jest.requireActual('@tanstack/react-query'),
useQueryClient: jest.fn(),
}));
jest.mock('../data/hooks', () => ({
...jest.requireActual('../data/hooks'),
useEnterpriseGroupUuid: jest.fn(),
Expand Down Expand Up @@ -52,7 +58,9 @@ const GroupDetailPageWrapper = ({
return (
<IntlProvider locale="en">
<Provider store={store}>
<GroupDetailPage />
<QueryClientProvider client={queryClient()}>
<GroupDetailPage />
</QueryClientProvider>
</Provider>
</IntlProvider>
);
Expand Down

0 comments on commit 368dfe2

Please sign in to comment.