Skip to content

Commit

Permalink
test: add integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
g-saracca committed Nov 11, 2024
1 parent a899f65 commit 654db9d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 3 deletions.
5 changes: 5 additions & 0 deletions test/integration/collections/CollectionsRepository.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { CollectionPayload } from '../../../src/collections/infra/repositories/t
import { uploadFileViaApi } from '../../testHelpers/files/filesHelper'
import { deleteUnpublishedDatasetViaApi } from '../../testHelpers/datasets/datasetHelper'
import { PublicationStatus } from '../../../src/core/domain/models/PublicationStatus'
import { CollectionType } from '../../../src/collections/domain/models/CollectionType'

describe('CollectionsRepository', () => {
const testCollectionAlias = 'collectionsRepositoryTestCollection'
Expand Down Expand Up @@ -61,6 +62,10 @@ describe('CollectionsRepository', () => {
expect(actual.affiliation).toBe(undefined)
expect(actual.description).toBe('The root dataverse.')
expect(actual.inputLevels).toBe(undefined)
expect(actual.type).toBe(CollectionType.UNCATEGORIZED)
expect(actual.contacts).toEqual([{ email: '[email protected]', displayOrder: 0 }])
expect(actual.usesMetadataFieldsFromParent).toBe(true)
expect(actual.usesBrowseSearchFacetsFromParent).toBe(true)
})

test('should return isReleased is true for root collection', async () => {
Expand Down
25 changes: 22 additions & 3 deletions test/testHelpers/collections/collectionHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ import { DvObjectType } from '../../../src'
import { CollectionPayload } from '../../../src/collections/infra/repositories/transformers/CollectionPayload'
import { TestConstants } from '../TestConstants'
import axios from 'axios'
import { CollectionDTO, CollectionType } from '../../../src/collections/domain/dtos/CollectionDTO'
import { CollectionDTO } from '../../../src/collections/domain/dtos/CollectionDTO'
import { NewCollectionRequestPayload } from '../../../src/collections/infra/repositories/CollectionsRepository'
import { CollectionFacetPayload } from '../../../src/collections/infra/repositories/transformers/CollectionFacetPayload'
import { CollectionType } from '../../../src/collections/domain/models/CollectionType'

const COLLECTION_ID = 11111
const COLLECTION_IS_RELEASED = true
Expand Down Expand Up @@ -35,7 +36,16 @@ export const createCollectionModel = (): Collection => {
required: true,
include: true
}
]
],
type: CollectionType.UNCATEGORIZED,
contacts: [
{
email: '[email protected]',
displayOrder: 0
}
],
usesMetadataFieldsFromParent: true,
usesBrowseSearchFacetsFromParent: true
}
return collectionModel
}
Expand All @@ -55,7 +65,16 @@ export const createCollectionPayload = (): CollectionPayload => {
required: true,
include: true
}
]
],
dataverseType: CollectionType.UNCATEGORIZED,
dataverseContacts: [
{
contactEmail: '[email protected]',
displayOrder: 0
}
],
usesBrowseSearchFacetsFromParent: true,
usesMetadataFieldsFromParent: true
}
return collectionPayload
}
Expand Down

0 comments on commit 654db9d

Please sign in to comment.