@@ -41,6 +41,13 @@ describe('CollectionsRepository', () => {
4141 test ( 'should return the root collection of the Dataverse installation if no parameter is passed AS `root`' , async ( ) => {
4242 const actual = await sut . getCollection ( )
4343 expect ( actual . alias ) . toBe ( ROOT_COLLECTION_ALIAS )
44+ expect ( actual . id ) . toBe ( 1 )
45+ expect ( actual . name ) . toBe ( 'Root' )
46+ expect ( actual . alias ) . toBe ( 'root' )
47+ expect ( actual . isReleased ) . toBe ( true )
48+ expect ( actual . affiliation ) . toBe ( undefined )
49+ expect ( actual . description ) . toBe ( 'The root dataverse.' )
50+ expect ( actual . inputLevels ) . toBe ( undefined )
4451 } )
4552
4653 test ( 'should return isReleased is true for root collection' , async ( ) => {
@@ -97,16 +104,33 @@ describe('CollectionsRepository', () => {
97104 } )
98105
99106 test ( 'should create collection in root when no parent collection is set' , async ( ) => {
100- const actual = await sut . createCollection ( createCollectionDTO ( testCreateCollectionAlias1 ) )
101- expect ( typeof actual ) . toBe ( 'number' )
107+ const newCollectionDTO = createCollectionDTO ( testCreateCollectionAlias1 )
108+ const actualId = await sut . createCollection ( newCollectionDTO )
109+ expect ( typeof actualId ) . toBe ( 'number' )
110+
111+ const createdCollection = await sut . getCollection ( actualId )
112+
113+ expect ( createdCollection . id ) . toBe ( actualId )
114+ expect ( createdCollection . alias ) . toBe ( newCollectionDTO . alias )
115+ expect ( createdCollection . name ) . toBe ( newCollectionDTO . name )
116+ expect ( createdCollection . affiliation ) . toBe ( newCollectionDTO . affiliation )
117+ expect ( createdCollection . isPartOf . type ) . toBe ( 'DATAVERSE' )
118+ expect ( createdCollection . isPartOf . displayName ) . toBe ( 'Root' )
119+ expect ( createdCollection . isPartOf . identifier ) . toBe ( 'root' )
120+
121+ expect ( createdCollection . inputLevels ?. length ) . toBe ( 1 )
122+ const inputLevel = createdCollection . inputLevels ?. [ 0 ]
123+ expect ( inputLevel ?. datasetFieldName ) . toBe ( 'geographicCoverage' )
124+ expect ( inputLevel ?. include ) . toBe ( true )
125+ expect ( inputLevel ?. required ) . toBe ( true )
102126 } )
103127
104128 test ( 'should create collection in parent collection when parent collection is set' , async ( ) => {
105- const actual = await sut . createCollection (
129+ const actualId = await sut . createCollection (
106130 createCollectionDTO ( testCreateCollectionAlias2 ) ,
107131 testCollectionId
108132 )
109- expect ( typeof actual ) . toBe ( 'number' )
133+ expect ( typeof actualId ) . toBe ( 'number' )
110134 } )
111135
112136 test ( 'should return error when parent collection does not exist' , async ( ) => {
0 commit comments