@@ -1072,3 +1072,64 @@ mockGetEntityLinks.applyMock = () => jest.spyOn(
10721072 courseLibApi ,
10731073 'getEntityLinks' ,
10741074) . mockImplementation ( mockGetEntityLinks ) ;
1075+
1076+ export async function mockGetCourseImports ( libraryId : string ) : ReturnType < typeof api . getCourseImports > {
1077+ switch ( libraryId ) {
1078+ case mockContentLibrary . libraryId :
1079+ return [
1080+ mockGetCourseImports . succeedImport ,
1081+ mockGetCourseImports . succeedImportWithCollection ,
1082+ mockGetCourseImports . failImport ,
1083+ mockGetCourseImports . inProgressImport ,
1084+ ] ;
1085+ case mockGetCourseImports . emptyLibraryId :
1086+ return [ ] ;
1087+ default :
1088+ throw new Error ( `mockGetCourseImports doesn't know how to mock ${ JSON . stringify ( libraryId ) } ` ) ;
1089+ }
1090+ }
1091+ mockGetCourseImports . libraryId = mockContentLibrary . libraryId ;
1092+ mockGetCourseImports . emptyLibraryId = mockContentLibrary . libraryId2 ;
1093+ mockGetCourseImports . succeedImport = {
1094+ source : {
1095+ key : 'course-v1:edX+DemoX+2025_T1' ,
1096+ displayName : 'DemoX 2025 T1' ,
1097+ } ,
1098+ targetCollection : null ,
1099+ state : 'Succeeded' ,
1100+ progress : 1 ,
1101+ } satisfies api . CourseImport ;
1102+ mockGetCourseImports . succeedImportWithCollection = {
1103+ source : {
1104+ key : 'course-v1:edX+DemoX+2025_T2' ,
1105+ displayName : 'DemoX 2025 T2' ,
1106+ } ,
1107+ targetCollection : {
1108+ key : 'sample-collection' ,
1109+ title : 'DemoX 2025 T1 (2)' ,
1110+ } ,
1111+ state : 'Succeeded' ,
1112+ progress : 1 ,
1113+ } satisfies api . CourseImport ;
1114+ mockGetCourseImports . failImport = {
1115+ source : {
1116+ key : 'course-v1:edX+DemoX+2025_T3' ,
1117+ displayName : 'DemoX 2025 T3' ,
1118+ } ,
1119+ targetCollection : null ,
1120+ state : 'Failed' ,
1121+ progress : 0.30 ,
1122+ } satisfies api . CourseImport ;
1123+ mockGetCourseImports . inProgressImport = {
1124+ source : {
1125+ key : 'course-v1:edX+DemoX+2025_T4' ,
1126+ displayName : 'DemoX 2025 T4' ,
1127+ } ,
1128+ targetCollection : null ,
1129+ state : 'In Progress' ,
1130+ progress : 0.5012 ,
1131+ } satisfies api . CourseImport ;
1132+ mockGetCourseImports . applyMock = ( ) => jest . spyOn (
1133+ api ,
1134+ 'getCourseImports' ,
1135+ ) . mockImplementation ( mockGetCourseImports ) ;
0 commit comments