Skip to content

Commit

Permalink
chore: Fix rebase conflicts and issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisChV committed Mar 11, 2024
1 parent 14fd7cd commit 67cfe58
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/course-unit/CourseUnit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ const CourseUnit = ({ courseId }) => {
<Layout.Element>
<Stack gap={3}>
<Sidebar blockId={blockId} variant="publish" data-testid="course-unit-sidebar" />
<Sidebar variant="location" data-testid="course-unit-location-sidebar" />
<Sidebar variant="tags" />
<Sidebar variant="location" data-testid="course-unit-location-sidebar" />
</Stack>
</Layout.Element>
</Layout>
Expand Down
32 changes: 32 additions & 0 deletions src/course-unit/CourseUnit.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import deleteModalMessages from '../generic/delete-modal/messages';
import courseXBlockMessages from './course-xblock/messages';
import addComponentMessages from './add-component/messages';
import { PUBLISH_TYPES, UNIT_VISIBILITY_STATES } from './constants';
import { getContentTaxonomyTagsApiUrl, getContentTaxonomyTagsCountApiUrl } from '../content-tags-drawer/data/api';

let axiosMock;
let store;
Expand All @@ -59,6 +60,31 @@ jest.mock('react-router-dom', () => ({
useNavigate: () => mockedUsedNavigate,
}));

jest.mock('@tanstack/react-query', () => ({
useQuery: jest.fn(({ queryKey }) => {
if (queryKey[0] === 'contentTaxonomyTags') {
return {
data: {
taxonomies: [],
},
isSuccess: true,
};
} if (queryKey[0] === 'contentTaxonomyTagsCount') {
return {
data: 17,
isSuccess: true,
};
}
return {
data: {},
isSuccess: true,
};
}),
useQueryClient: jest.fn(() => ({
setQueryData: jest.fn(),
})),
}));

const RootWrapper = () => (
<AppProvider store={store}>
<IntlProvider locale="en">
Expand Down Expand Up @@ -92,6 +118,12 @@ describe('<CourseUnit />', () => {
.onGet(getCourseVerticalChildrenApiUrl(blockId))
.reply(200, courseVerticalChildrenMock);
await executeThunk(fetchCourseVerticalChildrenData(blockId), store.dispatch);
axiosMock
.onGet(getContentTaxonomyTagsApiUrl(blockId))
.reply(200, {});
axiosMock
.onGet(getContentTaxonomyTagsCountApiUrl(blockId))
.reply(200, 17);
});

it('render CourseUnit component correctly', async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useDispatch, useSelector } from 'react-redux';
import PropTypes from 'prop-types';
import { Link, useNavigate } from 'react-router-dom';
import { useNavigate } from 'react-router-dom';
import { Button } from '@openedx/paragon';
import { Plus as PlusIcon } from '@openedx/paragon/icons';
import { useIntl } from '@edx/frontend-platform/i18n';
Expand Down

0 comments on commit 67cfe58

Please sign in to comment.