Skip to content

Commit 1429417

Browse files
committed
Added: functional test for GetAllFacetableDatasetFields
1 parent 7fa4540 commit 1429417

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { ApiConfig, MetadataFieldInfo, getAllFacetableDatasetFields } from '../../../src'
2+
import { TestConstants } from '../../testHelpers/TestConstants'
3+
import { DataverseApiAuthMechanism } from '../../../src/core/infra/repositories/ApiConfig'
4+
5+
describe('execute', () => {
6+
beforeAll(async () => {
7+
ApiConfig.init(
8+
TestConstants.TEST_API_URL,
9+
DataverseApiAuthMechanism.API_KEY,
10+
process.env.TEST_API_KEY
11+
)
12+
})
13+
14+
test('should return all facetable dataset fields', async () => {
15+
let metadataFieldInfos: MetadataFieldInfo[] = null
16+
try {
17+
metadataFieldInfos = await getAllFacetableDatasetFields.execute()
18+
} catch (error) {
19+
throw new Error('Should not raise an error')
20+
} finally {
21+
expect(metadataFieldInfos.length).toBe(59)
22+
expect(metadataFieldInfos[0].name).toBe('authorName')
23+
expect(metadataFieldInfos[0].displayName).toBe('Author Name')
24+
}
25+
})
26+
})

test/functional/metadataBlocks/GetCollectionMetadataBlocks.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { TestConstants } from '../../testHelpers/TestConstants'
33
import { DataverseApiAuthMechanism } from '../../../src/core/infra/repositories/ApiConfig'
44

55
describe('execute', () => {
6-
beforeEach(async () => {
6+
beforeAll(async () => {
77
ApiConfig.init(
88
TestConstants.TEST_API_URL,
99
DataverseApiAuthMechanism.API_KEY,

0 commit comments

Comments
 (0)