File tree Expand file tree Collapse file tree 2 files changed +9
-7
lines changed
api/src/mitxonline/test-utils/factories
main/src/app-pages/DashboardPage/CoursewareDisplay Expand file tree Collapse file tree 2 files changed +9
-7
lines changed Original file line number Diff line number Diff line change 1
1
import { mergeOverrides , makePaginatedFactory } from "ol-test-utilities"
2
2
import type { PartialFactory } from "ol-test-utilities"
3
- import type { V2CourseWithCourseRuns } from "@mitodl/mitxonline-api-axios/v2"
3
+ import type { CourseWithCourseRunsSerializerV2 } from "@mitodl/mitxonline-api-axios/v2"
4
4
import { faker } from "@faker-js/faker/locale/en"
5
5
import { UniqueEnforcer } from "enforce-unique"
6
6
7
7
const uniqueCourseId = new UniqueEnforcer ( )
8
8
const uniqueCourseRunId = new UniqueEnforcer ( )
9
9
10
- const course : PartialFactory < V2CourseWithCourseRuns > = ( overrides = { } ) => {
11
- const defaults : V2CourseWithCourseRuns = {
10
+ const course : PartialFactory < CourseWithCourseRunsSerializerV2 > = (
11
+ overrides = { } ,
12
+ ) => {
13
+ const defaults : CourseWithCourseRunsSerializerV2 = {
12
14
id : uniqueCourseId . enforce ( ( ) => faker . number . int ( ) ) ,
13
15
title : faker . lorem . words ( 3 ) ,
14
16
readable_id : faker . lorem . slug ( ) ,
@@ -86,7 +88,7 @@ const course: PartialFactory<V2CourseWithCourseRuns> = (overrides = {}) => {
86
88
ingest_content_files_for_ai : faker . datatype . boolean ( ) ,
87
89
}
88
90
89
- return mergeOverrides < V2CourseWithCourseRuns > ( defaults , overrides )
91
+ return mergeOverrides < CourseWithCourseRunsSerializerV2 > ( defaults , overrides )
90
92
}
91
93
92
94
const courses = makePaginatedFactory ( course )
Original file line number Diff line number Diff line change 6
6
7
7
import {
8
8
CourseRunEnrollment ,
9
- V2CourseWithCourseRuns ,
9
+ CourseWithCourseRunsSerializerV2 ,
10
10
V2Program ,
11
11
V2ProgramCollection ,
12
12
} from "@mitodl/mitxonline-api-axios/v2"
@@ -72,7 +72,7 @@ const mitxonlineEnrollments = (data: CourseRunEnrollment[]) =>
72
72
data . map ( ( course ) => mitxonlineEnrollment ( course ) )
73
73
74
74
const mitxonlineUnenrolledCourse = (
75
- course : V2CourseWithCourseRuns ,
75
+ course : CourseWithCourseRunsSerializerV2 ,
76
76
) : DashboardCourse => {
77
77
const run = course . courseruns . find ( ( run ) => run . id === course . next_run_id )
78
78
return {
@@ -98,7 +98,7 @@ const mitxonlineUnenrolledCourse = (
98
98
}
99
99
100
100
const mitxonlineCourses = ( raw : {
101
- courses : V2CourseWithCourseRuns [ ]
101
+ courses : CourseWithCourseRunsSerializerV2 [ ]
102
102
enrollments : CourseRunEnrollment [ ]
103
103
} ) => {
104
104
const enrollmentsByCourseId = groupBy (
You can’t perform that action at this time.
0 commit comments