@@ -28,6 +28,7 @@ describe('DataverseClient', () => {
2828 let axiosGetStub : SinonStub
2929 let axiosPostStub : SinonStub
3030 let requestPostStub : SinonStub
31+ let axiosDeleteStub : SinonStub
3132
3233 let mapBasicDatasetInformationStub : SinonStub
3334 let getErrorMessageStub : SinonStub
@@ -63,6 +64,7 @@ describe('DataverseClient', () => {
6364 axiosGetStub = sandbox . stub ( axios , 'get' ) . resolves ( mockResponse )
6465 axiosPostStub = sandbox . stub ( axios , 'post' ) . resolves ( mockResponse )
6566 requestPostStub = sandbox . stub ( request , 'post' ) . resolves ( mockResponse )
67+ axiosDeleteStub = sandbox . stub ( axios , 'delete' ) . resolves ( mockResponse )
6668
6769 mapBasicDatasetInformationStub = sandbox . stub ( DatasetUtil , 'mapBasicDatasetInformation' ) . returns ( mockDatasetInformation )
6870 getErrorMessageStub = sandbox . stub ( ResponseUtil , 'getErrorMessage' ) . returns ( mockErrorMessage )
@@ -1480,5 +1482,18 @@ describe('DataverseClient', () => {
14801482 expect ( error . errorCode ) . to . be . equal ( errorCode )
14811483 } )
14821484 } )
1485+
14831486 } )
1484- } )
1487+
1488+ describe ( 'deleteDataset()' , ( ) => {
1489+ it ( 'should call axios with expected url' , async ( ) => {
1490+ const datasetId : string = random . number ( ) . toString ( )
1491+
1492+ await client . deleteDataset ( datasetId )
1493+
1494+ assert . calledOnce ( axiosDeleteStub )
1495+ assert . calledWithExactly ( axiosDeleteStub , `${ host } /api/datasets/:persistentId/destroy/?persistentId=${ datasetId } ` , { headers : { 'X-Dataverse-key' : apiToken } } )
1496+ } )
1497+ } )
1498+
1499+ } )
0 commit comments