@@ -576,6 +576,42 @@ describe('FilesRepository', () => {
576576 } )
577577 } )
578578
579+ describe ( 'updateFileMetadata' , ( ) => {
580+ test ( 'should return error when file does not exist' , async ( ) => {
581+ const nonExistentFiledId = 4000
582+ const testFileMetadata = {
583+ description : 'My description bbb.' ,
584+ categories : [ 'Data' ] ,
585+ restrict : false
586+ }
587+ const errorExpected = new WriteError ( `[400] Error attempting get the requested data file.` )
588+
589+ await expect ( sut . updateFileMetadata ( nonExistentFiledId , testFileMetadata ) ) . rejects . toThrow (
590+ errorExpected
591+ )
592+ } )
593+
594+ test ( 'should update file metadata when file exists' , async ( ) => {
595+ const getDatasetFilesResponse = await sut . getDatasetFiles (
596+ testDatasetIds . numericId ,
597+ latestDatasetVersionId ,
598+ false ,
599+ FileOrderCriteria . NAME_AZ
600+ )
601+
602+ const fileId = getDatasetFilesResponse . files [ 0 ] . id
603+ const testFileMetadata = {
604+ description : 'My description bbb.' ,
605+ categories : [ 'Data' ] ,
606+ restrict : false
607+ }
608+
609+ const actual = await sut . updateFileMetadata ( fileId , testFileMetadata )
610+
611+ expect ( actual ) . toBeUndefined ( )
612+ } )
613+ } )
614+
579615 describe ( 'getFileUploadDestination' , ( ) => {
580616 const testCollectionAlias = 'getFileUploadDestinationsTestCollection'
581617 let testDataset2Ids : CreatedDatasetIdentifiers
0 commit comments