@@ -258,6 +258,7 @@ mockCreateLibraryBlock.newHtmlData = {
258258 publishedBy : null , // or e.g. 'test_author',
259259 lastDraftCreated : '2024-07-22T21:37:49Z' ,
260260 lastDraftCreatedBy : null ,
261+ createdBy : null ,
261262 created : '2024-07-22T21:37:49Z' ,
262263 modified : '2024-07-22T21:37:49Z' ,
263264 tagsCount : 0 ,
@@ -273,6 +274,7 @@ mockCreateLibraryBlock.newProblemData = {
273274 publishedBy : null , // or e.g. 'test_author',
274275 lastDraftCreated : '2024-07-22T21:37:49Z' ,
275276 lastDraftCreatedBy : null ,
277+ createdBy : null ,
276278 created : '2024-07-22T21:37:49Z' ,
277279 modified : '2024-07-22T21:37:49Z' ,
278280 tagsCount : 0 ,
@@ -288,6 +290,7 @@ mockCreateLibraryBlock.newVideoData = {
288290 publishedBy : null , // or e.g. 'test_author',
289291 lastDraftCreated : '2024-07-22T21:37:49Z' ,
290292 lastDraftCreatedBy : null ,
293+ createdBy : null ,
291294 created : '2024-07-22T21:37:49Z' ,
292295 modified : '2024-07-22T21:37:49Z' ,
293296 tagsCount : 0 ,
@@ -459,6 +462,7 @@ mockLibraryBlockMetadata.dataNeverPublished = {
459462 lastDraftCreated : null ,
460463 lastDraftCreatedBy : null ,
461464 hasUnpublishedChanges : true ,
465+ createdBy : null ,
462466 created : '2024-06-20T13:54:21Z' ,
463467 modified : '2024-06-21T13:54:21Z' ,
464468 tagsCount : 0 ,
@@ -478,6 +482,7 @@ mockLibraryBlockMetadata.dataPublished = {
478482 created : '2024-06-20T13:54:21Z' ,
479483 modified : '2024-06-21T13:54:21Z' ,
480484 tagsCount : 0 ,
485+ createdBy : null ,
481486 collections : [ ] ,
482487} satisfies api . LibraryBlockMetadata ;
483488mockLibraryBlockMetadata . usageKeyPublishDisabled = 'lb:Axim:TEST2-disabled:html:571fe018-f3ce-45c9-8f53-5dafcb422fd2' ;
@@ -504,6 +509,7 @@ mockLibraryBlockMetadata.dataWithCollections = {
504509 lastDraftCreated : null ,
505510 lastDraftCreatedBy : '2024-06-20T20:00:00Z' ,
506511 hasUnpublishedChanges : false ,
512+ createdBy : null ,
507513 created : '2024-06-20T13:54:21Z' ,
508514 modified : '2024-06-21T13:54:21Z' ,
509515 tagsCount : 0 ,
@@ -521,6 +527,7 @@ mockLibraryBlockMetadata.dataPublishedWithChanges = {
521527 lastDraftCreated : null ,
522528 lastDraftCreatedBy : '2024-06-20T20:00:00Z' ,
523529 hasUnpublishedChanges : true ,
530+ createdBy : null ,
524531 created : '2024-06-20T13:54:21Z' ,
525532 modified : '2024-06-23T13:54:21Z' ,
526533 tagsCount : 0 ,
@@ -741,6 +748,7 @@ mockGetContainerChildren.childTemplate = {
741748 publishedBy : null ,
742749 lastDraftCreated : null ,
743750 lastDraftCreatedBy : null ,
751+ createdBy : null ,
744752 hasUnpublishedChanges : false ,
745753 created : null ,
746754 modified : null ,
@@ -1229,6 +1237,136 @@ mockGetCourseImports.applyMock = () =>
12291237 'getCourseImports' ,
12301238 ) . mockImplementation ( mockGetCourseImports ) ;
12311239
1240+ /**
1241+ * Mock for `getLibraryBlockDraftHistory()`
1242+ *
1243+ * Use `mockLibraryBlockDraftHistory.applyMock()` to apply it to the whole test suite.
1244+ */
1245+ export async function mockLibraryBlockDraftHistory ( usageKey : string ) : Promise < api . LibraryHistoryEntry [ ] > {
1246+ const thisMock = mockLibraryBlockDraftHistory ;
1247+ switch ( usageKey ) {
1248+ case thisMock . usageKey : return thisMock . data ;
1249+ case thisMock . usageKeyEmpty : return [ ] ;
1250+ default : throw new Error ( `No mock has been set up for usageKey "${ usageKey } "` ) ;
1251+ }
1252+ }
1253+ mockLibraryBlockDraftHistory . usageKey = 'lb:Axim:TEST1:html:571fe018-f3ce-45c9-8f53-5dafcb422fd1' ;
1254+ mockLibraryBlockDraftHistory . usageKeyEmpty = 'lb:Axim:TEST2:html:571fe018-f3ce-45c9-8f53-5dafcb422fd2' ;
1255+ const mockContributor = ( username : string ) : api . LibraryPublishContributor => ( {
1256+ username,
1257+ profileImageUrls : {
1258+ full : 'icon/mock/path' ,
1259+ large : 'icon/mock/path' ,
1260+ medium : 'icon/mock/path' ,
1261+ small : 'icon/mock/path' ,
1262+ } ,
1263+ } ) ;
1264+
1265+ mockLibraryBlockDraftHistory . data = [
1266+ {
1267+ changedBy : mockContributor ( 'test_user_1' ) ,
1268+ changedAt : '2026-03-16T11:00:00Z' ,
1269+ title : 'Electron Arcs' ,
1270+ action : 'edited' ,
1271+ blockType : 'html' ,
1272+ } ,
1273+ {
1274+ changedBy : mockContributor ( 'test_user_2' ) ,
1275+ changedAt : '2026-03-13T10:00:00Z' ,
1276+ title : 'More on Quarks' ,
1277+ action : 'renamed' ,
1278+ blockType : 'html' ,
1279+ } ,
1280+ ] satisfies api . LibraryHistoryEntry [ ] ;
1281+ mockLibraryBlockDraftHistory . applyMock = ( ) => jest . spyOn ( api , 'getLibraryBlockDraftHistory' ) . mockImplementation ( mockLibraryBlockDraftHistory ) ;
1282+
1283+ /**
1284+ * Mock for `getLibraryBlockPublishHistory()`
1285+ *
1286+ * Use `mockLibraryBlockPublishHistory.applyMock()` to apply it to the whole test suite.
1287+ */
1288+ export async function mockLibraryBlockPublishHistory ( usageKey : string ) : Promise < api . LibraryPublishHistoryGroup [ ] > {
1289+ const thisMock = mockLibraryBlockPublishHistory ;
1290+ switch ( usageKey ) {
1291+ case thisMock . usageKeyWithGroups : return thisMock . data ;
1292+ case thisMock . usageKeyEmpty : return [ ] ;
1293+ default : throw new Error ( `No mock has been set up for usageKey "${ usageKey } "` ) ;
1294+ }
1295+ }
1296+ mockLibraryBlockPublishHistory . usageKeyWithGroups = 'lb:Axim:TEST1:html:571fe018-f3ce-45c9-8f53-5dafcb422fd1' ;
1297+ mockLibraryBlockPublishHistory . usageKeyEmpty = 'lb:Axim:TEST2:html:571fe018-f3ce-45c9-8f53-5dafcb422fd2' ;
1298+ mockLibraryBlockPublishHistory . data = [
1299+ {
1300+ publishLogUuid : 'abc-123' ,
1301+ title : 'Protons' ,
1302+ blockType : 'html' ,
1303+ publishedBy : 'author' ,
1304+ publishedAt : '2026-03-14T10:00:00Z' ,
1305+ contributors : [ 'test_user_1' , 'test_user_2' , 'test_user_3' , 'test_user_4' , 'test_user_5' ] . map ( mockContributor ) ,
1306+ contributorsCount : 5 ,
1307+ } ,
1308+ ] satisfies api . LibraryPublishHistoryGroup [ ] ;
1309+ mockLibraryBlockPublishHistory . applyMock = ( ) => jest . spyOn ( api , 'getLibraryBlockPublishHistory' ) . mockImplementation ( mockLibraryBlockPublishHistory ) ;
1310+
1311+ /**
1312+ * Mock for `getLibraryBlockPublishHistoryEntries()`
1313+ *
1314+ * Use `mockLibraryBlockPublishHistoryEntries.applyMock()` to apply it to the whole test suite.
1315+ */
1316+ export async function mockLibraryBlockPublishHistoryEntries (
1317+ _usageKey : string ,
1318+ _publishGroupId : string ,
1319+ ) : Promise < api . LibraryHistoryEntry [ ] > {
1320+ return mockLibraryBlockPublishHistoryEntries . data ;
1321+ }
1322+ mockLibraryBlockPublishHistoryEntries . data = [
1323+ {
1324+ changedBy : mockContributor ( 'test_user' ) ,
1325+ changedAt : '2026-03-10T09:00:00Z' ,
1326+ title : 'Protons' ,
1327+ action : 'edited' ,
1328+ blockType : 'html' ,
1329+ } ,
1330+ ] satisfies api . LibraryHistoryEntry [ ] ;
1331+ mockLibraryBlockPublishHistoryEntries . applyMock = ( ) => jest . spyOn (
1332+ api ,
1333+ 'getLibraryBlockPublishHistoryEntries' ,
1334+ ) . mockImplementation ( mockLibraryBlockPublishHistoryEntries ) ;
1335+
1336+ /**
1337+ * Mock for `getLibraryBlockCreationEntry()`
1338+ *
1339+ * Use `mockLibraryBlockCreationEntry.applyMock()` to apply it to the whole test suite.
1340+ */
1341+ export async function mockLibraryBlockCreationEntry ( usageKey : string ) : Promise < api . LibraryHistoryEntry > {
1342+ const thisMock = mockLibraryBlockCreationEntry ;
1343+ switch ( usageKey ) {
1344+ case thisMock . usageKeyThatNeverLoads :
1345+ return new Promise < any > ( ( ) => { } ) ;
1346+ case thisMock . usageKey : return thisMock . data ;
1347+ case thisMock . usageKeyEmpty : return thisMock . dataEmpty ;
1348+ default : throw new Error ( `No mock has been set up for usageKey "${ usageKey } "` ) ;
1349+ }
1350+ }
1351+ mockLibraryBlockCreationEntry . usageKeyThatNeverLoads = 'lb:Axim:infiniteLoading:html:123' ;
1352+ mockLibraryBlockCreationEntry . usageKey = 'lb:Axim:TEST1:html:571fe018-f3ce-45c9-8f53-5dafcb422fd1' ;
1353+ mockLibraryBlockCreationEntry . usageKeyEmpty = 'lb:Axim:TEST2:html:571fe018-f3ce-45c9-8f53-5dafcb422fd2' ;
1354+ mockLibraryBlockCreationEntry . data = {
1355+ changedBy : mockContributor ( 'author' ) ,
1356+ changedAt : '2024-01-01T00:00:00Z' ,
1357+ title : 'Introduction to Testing 1' ,
1358+ blockType : 'html' ,
1359+ action : 'created' ,
1360+ } satisfies api . LibraryHistoryEntry ;
1361+ mockLibraryBlockCreationEntry . dataEmpty = {
1362+ changedBy : mockContributor ( 'Author' ) ,
1363+ changedAt : '2024-01-01T00:00:00Z' ,
1364+ title : 'Introduction to Testing 2' ,
1365+ blockType : 'html' ,
1366+ action : 'created' ,
1367+ } satisfies api . LibraryHistoryEntry ;
1368+ mockLibraryBlockCreationEntry . applyMock = ( ) => jest . spyOn ( api , 'getLibraryBlockCreationEntry' ) . mockImplementation ( mockLibraryBlockCreationEntry ) ;
1369+
12321370export const mockGetMigrationInfo = {
12331371 applyMock : ( ) =>
12341372 jest . spyOn ( api , 'getMigrationInfo' ) . mockResolvedValue (
0 commit comments