File tree Expand file tree Collapse file tree
test/integration/collections Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -179,7 +179,29 @@ describe('CollectionsRepository', () => {
179179
180180 test ( 'should include allowedDatasetTypes field when retrieving a collection' , async ( ) => {
181181 const actual = await sut . getCollection ( testCollectionAlias )
182- expect ( actual ) . toHaveProperty ( 'allowedDatasetTypes' )
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+ }
183205 } )
184206 } )
185207
You can’t perform that action at this time.
0 commit comments