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 Feb 29, 2024
1 parent 67d6a3b commit 92eea93
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/course-unit/CourseUnit.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ const CourseUnit = ({ courseId }) => {
</Layout.Element>
<Layout.Element>
<Stack gap={3}>
<Sidebar variant="publish" data-testid="course-unit-sidebar" />
<Sidebar variant="location" data-testid="course-unit-location-sidebar" />
<Sidebar blockId={blockId} variant="publish" data-testid="course-unit-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
2 changes: 1 addition & 1 deletion src/course-unit/sidebar/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,11 @@ const Sidebar = ({ variant, blockId, ...props }) => {

Sidebar.propTypes = {
blockId: PropTypes.string,
variant: PropTypes.string.isRequired,
};

Sidebar.defaultProps = {
blockId: null,
variant: PropTypes.string.isRequired,
};

export default Sidebar;

0 comments on commit 92eea93

Please sign in to comment.