@@ -1533,6 +1533,21 @@ describe('DatasetsRepository', () => {
15331533 sut . linkDataset ( testDatasetIds . numericId , 'nonExistentCollectionAlias' )
15341534 ) . rejects . toThrow ( )
15351535 } )
1536+
1537+ test ( 'should link a dataset to another collection using persistent id' , async ( ) => {
1538+ const persistentCollectionAlias = 'testLinkDatasetCollectionPersistent'
1539+ await createCollectionViaApi ( persistentCollectionAlias )
1540+
1541+ const actual = await sut . linkDataset ( testDatasetIds . persistentId , persistentCollectionAlias )
1542+
1543+ expect ( actual ) . toBeUndefined ( )
1544+
1545+ const linkedCollections = await sut . getDatasetLinkedCollections ( testDatasetIds . numericId )
1546+ const aliases = linkedCollections . map ( ( c ) => c . alias )
1547+ expect ( aliases ) . toContain ( persistentCollectionAlias )
1548+
1549+ await deleteCollectionViaApi ( persistentCollectionAlias )
1550+ } )
15361551 } )
15371552
15381553 describe ( 'unlinkDataset' , ( ) => {
@@ -1578,6 +1593,27 @@ describe('DatasetsRepository', () => {
15781593 sut . unlinkDataset ( testDatasetIds . numericId , testCollectionAlias )
15791594 ) . rejects . toThrow ( )
15801595 } )
1596+
1597+ test ( 'should unlink a dataset from a collection using persistent id' , async ( ) => {
1598+ const persistentCollectionAlias = 'testUnlinkDatasetCollectionPersistent'
1599+ await createCollectionViaApi ( persistentCollectionAlias )
1600+
1601+ await sut . linkDataset ( testDatasetIds . persistentId , persistentCollectionAlias )
1602+ const linkedCollections = await sut . getDatasetLinkedCollections ( testDatasetIds . numericId )
1603+ const aliases = linkedCollections . map ( ( c ) => c . alias )
1604+ expect ( aliases ) . toContain ( persistentCollectionAlias )
1605+
1606+ const actual = await sut . unlinkDataset ( testDatasetIds . persistentId , persistentCollectionAlias )
1607+
1608+ expect ( actual ) . toBeUndefined ( )
1609+ const updatedLinkedCollections = await sut . getDatasetLinkedCollections (
1610+ testDatasetIds . numericId
1611+ )
1612+ const updatedAliases = updatedLinkedCollections . map ( ( c ) => c . alias )
1613+ expect ( updatedAliases ) . not . toContain ( persistentCollectionAlias )
1614+
1615+ await deleteCollectionViaApi ( persistentCollectionAlias )
1616+ } )
15811617 } )
15821618
15831619 describe ( 'getDatasetLinkedCollections' , ( ) => {
0 commit comments