@@ -11,6 +11,7 @@ import { db } from '../../drizzle/db';
1111import { assertIsDefined } from '../../utils/assertions' ;
1212import { ItemNotFound , MemberCannotAccess } from '../../utils/errors' ;
1313import { assertIsMemberForTest } from '../authentication' ;
14+ import { H5PItem } from './item' ;
1415import { type PackedItem , PackedItemDTO } from './packedItem.dto' ;
1516import { expectManyPackedItems , expectPackedItem , expectThumbnails } from './test/fixtures/items' ;
1617import { Ordering , SortBy } from './types' ;
@@ -336,7 +337,6 @@ describe('Item routes tests', () => {
336337 ] ,
337338 } ,
338339 // schema check
339-
340340 {
341341 name : 'app with settings' ,
342342 type : 'app' ,
@@ -947,6 +947,46 @@ describe('Item routes tests', () => {
947947 data . forEach ( ( i ) => expectThumbnails ( i , MOCK_SIGNED_URL , false ) ) ;
948948 } ) ;
949949
950+ it ( 'Returns a child h5p successfully' , async ( ) => {
951+ const {
952+ actor,
953+ items : [ parentItem ] ,
954+ } = await seedFromJson ( {
955+ items : [
956+ {
957+ memberships : [ { account : 'actor' , permission : 'admin' } ] ,
958+ children : [
959+ {
960+ type : 'h5p' ,
961+ extra : {
962+ h5p : {
963+ contentId : 'content-id' ,
964+ h5pFilePath : 'file-path' ,
965+ contentFilePath : 'content-file-path' ,
966+ } ,
967+ } ,
968+ } ,
969+ ] ,
970+ } ,
971+ ] ,
972+ } ) ;
973+ assertIsDefined ( actor ) ;
974+ assertIsMemberForTest ( actor ) ;
975+ mockAuthenticate ( actor ) ;
976+
977+ const response = await app . inject ( {
978+ method : HttpMethod . Get ,
979+ url : `/api/items/${ parentItem . id } /children` ,
980+ } ) ;
981+
982+ const data = response . json < PackedItem [ ] > ( ) ;
983+ expect ( response . statusCode ) . toBe ( StatusCodes . OK ) ;
984+
985+ expect ( data ) . toHaveLength ( 1 ) ;
986+ // expect additionnal packed property
987+ expect ( ( data [ 0 ] as H5PItem ) . extra . h5p . contentFilePath ) . toBeDefined ( ) ;
988+ } ) ;
989+
950990 it ( 'Returns successfully with thumbnails' , async ( ) => {
951991 const {
952992 actor,
0 commit comments