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 11import { mergeOverrides , makePaginatedFactory } from "ol-test-utilities"
22import 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"
44import { faker } from "@faker-js/faker/locale/en"
55import { UniqueEnforcer } from "enforce-unique"
66
77const uniqueCourseId = new UniqueEnforcer ( )
88const uniqueCourseRunId = new UniqueEnforcer ( )
99
10- const course : PartialFactory < V2CourseWithCourseRuns > = ( overrides = { } ) => {
11- const defaults : V2CourseWithCourseRuns = {
10+ const course : PartialFactory < CourseWithCourseRunsSerializerV2 > = (
11+ overrides = { } ,
12+ ) => {
13+ const defaults : CourseWithCourseRunsSerializerV2 = {
1214 id : uniqueCourseId . enforce ( ( ) => faker . number . int ( ) ) ,
1315 title : faker . lorem . words ( 3 ) ,
1416 readable_id : faker . lorem . slug ( ) ,
@@ -86,7 +88,7 @@ const course: PartialFactory<V2CourseWithCourseRuns> = (overrides = {}) => {
8688 ingest_content_files_for_ai : faker . datatype . boolean ( ) ,
8789 }
8890
89- return mergeOverrides < V2CourseWithCourseRuns > ( defaults , overrides )
91+ return mergeOverrides < CourseWithCourseRunsSerializerV2 > ( defaults , overrides )
9092}
9193
9294const courses = makePaginatedFactory ( course )
Original file line number Diff line number Diff line change 66
77import {
88 CourseRunEnrollment ,
9- V2CourseWithCourseRuns ,
9+ CourseWithCourseRunsSerializerV2 ,
1010 V2Program ,
1111 V2ProgramCollection ,
1212} from "@mitodl/mitxonline-api-axios/v2"
@@ -72,7 +72,7 @@ const mitxonlineEnrollments = (data: CourseRunEnrollment[]) =>
7272 data . map ( ( course ) => mitxonlineEnrollment ( course ) )
7373
7474const mitxonlineUnenrolledCourse = (
75- course : V2CourseWithCourseRuns ,
75+ course : CourseWithCourseRunsSerializerV2 ,
7676) : DashboardCourse => {
7777 const run = course . courseruns . find ( ( run ) => run . id === course . next_run_id )
7878 return {
@@ -98,7 +98,7 @@ const mitxonlineUnenrolledCourse = (
9898}
9999
100100const mitxonlineCourses = ( raw : {
101- courses : V2CourseWithCourseRuns [ ]
101+ courses : CourseWithCourseRunsSerializerV2 [ ]
102102 enrollments : CourseRunEnrollment [ ]
103103} ) => {
104104 const enrollmentsByCourseId = groupBy (
You can’t perform that action at this time.
0 commit comments