fix: [AA-1018] api cleanup
refactor - remove 'slice' prom from TabContainer.jsx
This commit is contained in:
@@ -66,7 +66,7 @@ subscribe(APP_READY, () => {
|
||||
)}
|
||||
/>
|
||||
<PageRoute path="/course/:courseId/course-end">
|
||||
<TabContainer tab="courseware" fetch={fetchCourse} slice="courseHome">
|
||||
<TabContainer tab="courseware" fetch={fetchCourse}>
|
||||
<CourseExit />
|
||||
</TabContainer>
|
||||
</PageRoute>
|
||||
|
||||
@@ -10,7 +10,6 @@ export default function TabContainer(props) {
|
||||
const {
|
||||
children,
|
||||
fetch,
|
||||
slice,
|
||||
tab,
|
||||
} = props;
|
||||
|
||||
@@ -26,14 +25,14 @@ export default function TabContainer(props) {
|
||||
const {
|
||||
courseId,
|
||||
courseStatus,
|
||||
} = useSelector(state => state[slice]);
|
||||
} = useSelector(state => state.courseHome);
|
||||
|
||||
return (
|
||||
<TabPage
|
||||
activeTabSlug={tab}
|
||||
courseId={courseId}
|
||||
courseStatus={courseStatus}
|
||||
metadataModel={`${slice}Meta`}
|
||||
metadataModel="courseHomeMeta"
|
||||
>
|
||||
{courseId && <OuterExamTimer courseId={courseId} />}
|
||||
{children}
|
||||
@@ -44,6 +43,5 @@ export default function TabContainer(props) {
|
||||
TabContainer.propTypes = {
|
||||
children: PropTypes.node.isRequired,
|
||||
fetch: PropTypes.func.isRequired,
|
||||
slice: PropTypes.string.isRequired,
|
||||
tab: PropTypes.string.isRequired,
|
||||
};
|
||||
|
||||
@@ -20,10 +20,8 @@ describe('Tab Container', () => {
|
||||
beforeEach(async () => {
|
||||
mockFetch = jest.fn().mockImplementation((x) => x);
|
||||
mockData = {
|
||||
children: [],
|
||||
fetch: mockFetch,
|
||||
tab: 'dummy',
|
||||
slice: 'courseware',
|
||||
};
|
||||
const store = await initializeTestStore({ excludeFetchSequence: true });
|
||||
courseId = store.getState().courseware.courseId;
|
||||
@@ -33,7 +31,9 @@ describe('Tab Container', () => {
|
||||
history.push(`/course/${courseId}`);
|
||||
render(
|
||||
<Route path="/course/:courseId">
|
||||
<TabContainer {...mockData} />
|
||||
<TabContainer {...mockData}>
|
||||
children={[]}
|
||||
</TabContainer>
|
||||
</Route>,
|
||||
);
|
||||
|
||||
@@ -56,8 +56,11 @@ describe('Tab Container', () => {
|
||||
render={({ match }) => (
|
||||
<TabContainer
|
||||
fetch={() => mockFetch(match.params.courseId, match.params.targetUserId)}
|
||||
slice="courseHome"
|
||||
/>
|
||||
tab="dummy"
|
||||
>
|
||||
children={[]}
|
||||
</TabContainer>
|
||||
|
||||
)}
|
||||
/>,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user