@@ -177,31 +177,11 @@ describe('CollectionsRepository', () => {
177177 await deleteCollectionViaApi ( parentCollectionAlias )
178178 } )
179179
180- test ( 'should include allowedDatasetTypes field when retrieving a collection' , async ( ) => {
180+ test ( 'should transform allowedDatasetTypes correctly when retrieving a collection' , async ( ) => {
181181 const actual = await sut . getCollection ( testCollectionAlias )
182- const allowedDatasetTypes = actual . allowedDatasetTypes
183-
184- if ( allowedDatasetTypes ) {
185- expect ( Array . isArray ( allowedDatasetTypes ) ) . toBe ( true )
186- allowedDatasetTypes . forEach ( ( datasetType ) => {
187- expect ( datasetType ) . toHaveProperty ( 'id' )
188- expect ( datasetType ) . toHaveProperty ( 'name' )
189- expect ( datasetType ) . toHaveProperty ( 'displayName' )
190- } )
191- }
192- } )
193-
194- test ( 'should return root collection with allowedDatasetTypes if configured' , async ( ) => {
195- const rootCollection = await sut . getCollection ( )
196- expect ( rootCollection . alias ) . toBe ( 'root' )
197- const allowedDatasetTypes = rootCollection . allowedDatasetTypes
198-
199- if ( allowedDatasetTypes ) {
200- expect ( Array . isArray ( allowedDatasetTypes ) ) . toBe ( true )
201- expect ( allowedDatasetTypes [ 0 ] ) . toHaveProperty ( 'id' )
202- expect ( allowedDatasetTypes [ 0 ] ) . toHaveProperty ( 'name' )
203- expect ( allowedDatasetTypes [ 0 ] ) . toHaveProperty ( 'displayName' )
204- }
182+ expect (
183+ actual . allowedDatasetTypes === undefined || Array . isArray ( actual . allowedDatasetTypes )
184+ ) . toBe ( true )
205185 } )
206186 } )
207187
0 commit comments