@@ -29,6 +29,7 @@ describe('DataverseClient', () => {
2929 let axiosPostStub : SinonStub
3030 let axiosPutStub : SinonStub
3131 let requestPostStub : SinonStub
32+ let axiosDeleteStub : SinonStub
3233
3334 let mapBasicDatasetInformationStub : SinonStub
3435 let getErrorMessageStub : SinonStub
@@ -65,6 +66,7 @@ describe('DataverseClient', () => {
6566 axiosPostStub = sandbox . stub ( axios , 'post' ) . resolves ( mockResponse )
6667 axiosPutStub = sandbox . stub ( axios , 'put' ) . resolves ( mockResponse )
6768 requestPostStub = sandbox . stub ( request , 'post' ) . resolves ( mockResponse )
69+ axiosDeleteStub = sandbox . stub ( axios , 'delete' ) . resolves ( mockResponse )
6870
6971 mapBasicDatasetInformationStub = sandbox . stub ( DatasetUtil , 'mapBasicDatasetInformation' ) . returns ( mockDatasetInformation )
7072 getErrorMessageStub = sandbox . stub ( ResponseUtil , 'getErrorMessage' ) . returns ( mockErrorMessage )
@@ -1482,6 +1484,7 @@ describe('DataverseClient', () => {
14821484 expect ( error . errorCode ) . to . be . equal ( errorCode )
14831485 } )
14841486 } )
1487+
14851488 } )
14861489
14871490 describe ( 'updateDataset()' , ( ) => {
@@ -1511,4 +1514,16 @@ describe('DataverseClient', () => {
15111514 } )
15121515 } )
15131516 } )
1517+
1518+ describe ( 'deleteDataset()' , ( ) => {
1519+ it ( 'should call axios with expected url' , async ( ) => {
1520+ const datasetId : string = random . number ( ) . toString ( )
1521+
1522+ await client . deleteDataset ( datasetId )
1523+
1524+ assert . calledOnce ( axiosDeleteStub )
1525+ assert . calledWithExactly ( axiosDeleteStub , `${ host } /api/datasets/:persistentId/destroy/?persistentId=${ datasetId } ` , { headers : { 'X-Dataverse-key' : apiToken } } )
1526+ } )
1527+ } )
1528+
15141529} )
0 commit comments