@@ -1484,6 +1484,69 @@ describe('DatasetsRepository', () => {
14841484 } )
14851485 } )
14861486
1487+ describe ( 'getDatasetStorageDriver' , ( ) => {
1488+ const testStorageDriverCollectionAlias = 'testDatasetStorageDriverCollection'
1489+ let testDatasetId : number
1490+
1491+ beforeAll ( async ( ) => {
1492+ await createCollectionViaApi ( testStorageDriverCollectionAlias )
1493+ await publishCollectionViaApi ( testStorageDriverCollectionAlias )
1494+ // await setStorageDriverViaApi(testStorageDriverCollectionAlias, 'LocalStack')
1495+
1496+ const { numericId } = await createDataset . execute (
1497+ TestConstants . TEST_NEW_DATASET_DTO ,
1498+ testStorageDriverCollectionAlias
1499+ )
1500+ testDatasetId = numericId
1501+ } )
1502+
1503+ afterAll ( async ( ) => {
1504+ await deleteUnpublishedDatasetViaApi ( testDatasetId )
1505+ await deleteCollectionViaApi ( testStorageDriverCollectionAlias )
1506+ } )
1507+
1508+ test ( 'should return correct storage driver' , async ( ) => {
1509+ const actual = await sut . getDatasetStorageDriver ( testDatasetId )
1510+
1511+ console . log ( actual )
1512+
1513+ expect ( actual ) . toBeDefined ( )
1514+ expect ( actual . name ) . toBe ( 'local' )
1515+ expect ( actual . type ) . toBe ( 's3' )
1516+ expect ( actual . label ) . toBe ( 'Local' )
1517+
1518+ /*
1519+
1520+ -Ddataverse.files.localstack1.type=s3
1521+ -Ddataverse.files.localstack1.label=LocalStack
1522+ -Ddataverse.files.localstack1.upload-redirect=true
1523+ -Ddataverse.files.localstack1.download-redirect=true
1524+ {
1525+ name: 'localstack1',
1526+ type: 's3',
1527+ label: 'LocalStack',
1528+ directUpload: false,
1529+ directDownload: true
1530+ }
1531+
1532+ {
1533+ name: 'local',
1534+ type: 'file',
1535+ label: 'Local',
1536+ directUpload: false,
1537+ directDownload: false
1538+ }
1539+
1540+ */
1541+ } )
1542+
1543+ test ( 'should return error when dataset does not exist' , async ( ) => {
1544+ await expect ( sut . getDatasetStorageDriver ( nonExistentTestDatasetId ) ) . rejects . toBeInstanceOf (
1545+ ReadError
1546+ )
1547+ } )
1548+ } )
1549+
14871550 describe ( 'getDatasetDownloadCount' , ( ) => {
14881551 const testGetDatasetDownloadCountCollectionAlias = 'testGetDatasetDownloadCountCollection'
14891552 let testDatasetIds : CreatedDatasetIdentifiers
0 commit comments