Skip to content

Commit a694d28

Browse files
committed
Changes for allowed dataset types
1 parent 7fa6e4d commit a694d28

1 file changed

Lines changed: 23 additions & 1 deletion

File tree

test/integration/collections/CollectionsRepository.test.ts

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff 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

0 commit comments

Comments
 (0)