feat: handle courseware paths more liberally (#395)
Valid courseware URLs currently include: * /course/:courseId * /course/:courseId/:sequenceId * /course/:courseId/:sequenceId/:unitId In this commit we add support for: * /course/:courseId/:sectionId * /course/:courseId/:sectionId/:unitId * /course/:courseId/:unitId All URL forms still redirect to: /course/:courseId/:sequenceId/:unitId See ADR #8 for more context. All changes: * refactor: allow courseBlocks factory to build multiple sections * refactor: make CoursewareContainer tests less brittle & stateful * feat: handle courseware paths more liberally * refactor: reorder, rename, & comment redirection functions TNL-7796
This commit is contained in:
@@ -132,7 +132,7 @@ export async function initializeTestStore(options = {}, overrideStore = true) {
|
||||
axiosMock.reset();
|
||||
|
||||
const {
|
||||
courseBlocks, sequenceBlock, courseMetadata, sequenceMetadata,
|
||||
courseBlocks, sequenceBlocks, courseMetadata, sequenceMetadata,
|
||||
} = buildSimpleCourseAndSequenceMetadata(options);
|
||||
|
||||
let forbiddenCourseUrl = `${getConfig().LMS_BASE_URL}/api/courseware/course/${courseMetadata.id}`;
|
||||
@@ -153,7 +153,7 @@ export async function initializeTestStore(options = {}, overrideStore = true) {
|
||||
!options.excludeFetchCourse && await executeThunk(fetchCourse(courseMetadata.id), store.dispatch);
|
||||
|
||||
if (!options.excludeFetchSequence) {
|
||||
await Promise.all(sequenceBlock
|
||||
await Promise.all(sequenceBlocks
|
||||
.map(block => executeThunk(fetchSequence(block.id), store.dispatch)));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user