@@ -26,7 +26,8 @@ import { MetadataBlocksRepository } from '../../../src/metadataBlocks/infra/repo
2626import {
2727 Author ,
2828 DatasetContact ,
29- DatasetDescription
29+ DatasetDescription ,
30+ Publication
3031} from '../../../src/datasets/domain/models/Dataset'
3132import {
3233 createCollectionViaApi ,
@@ -784,7 +785,16 @@ describe('DatasetsRepository', () => {
784785 dsDescriptionValue : 'This is the description of the dataset.'
785786 }
786787 ] ,
787- subject : [ 'Medicine, Health and Life Sciences' ]
788+ subject : [ 'Medicine, Health and Life Sciences' ] ,
789+ publication : [
790+ {
791+ publicationRelationType : 'Cites' ,
792+ publicationCitation : 'Some related publication citation' ,
793+ publicationIDType : 'cstr' ,
794+ publicationIDNumber : 'some identifier'
795+ }
796+ ] ,
797+ notesText : 'This is a note for the dataset.'
788798 }
789799 }
790800 ]
@@ -794,6 +804,7 @@ describe('DatasetsRepository', () => {
794804 const citationMetadataBlock = await metadataBlocksRepository . getMetadataBlockByName (
795805 'citation'
796806 )
807+
797808 const createdDataset = await sut . createDataset (
798809 testDataset ,
799810 [ citationMetadataBlock ] ,
@@ -812,9 +823,35 @@ describe('DatasetsRepository', () => {
812823 . dsDescriptionValue
813824 ) . toBe ( 'This is the description of the dataset.' )
814825
826+ expect ( actualCreatedDataset . metadataBlocks [ 0 ] . fields . notesText as string ) . toBe (
827+ 'This is a note for the dataset.'
828+ )
829+ expect (
830+ actualCreatedDataset . metadataBlocks [ 0 ] . fields . publication as Publication [ ]
831+ ) . toStrictEqual ( [
832+ {
833+ publicationRelationType : 'Cites' ,
834+ publicationCitation : 'Some related publication citation' ,
835+ publicationIDType : 'cstr' ,
836+ publicationIDNumber : 'some identifier'
837+ }
838+ ] )
839+
815840 const updatedDsDescription = 'This is the updated description of the dataset.'
841+ const updatedNotesText = ''
842+ const updatedPublication = [
843+ {
844+ publicationRelationType : '' ,
845+ publicationCitation : 'Some updated related publication citation' ,
846+ publicationIDType : '' ,
847+ publicationIDNumber : ''
848+ }
849+ ]
850+
816851 testDataset . metadataBlockValues [ 0 ] . fields . dsDescription [ 0 ] . dsDescriptionValue =
817852 updatedDsDescription
853+ testDataset . metadataBlockValues [ 0 ] . fields . notesText = updatedNotesText
854+ testDataset . metadataBlockValues [ 0 ] . fields . publication = updatedPublication
818855
819856 await sut . updateDataset ( createdDataset . numericId , testDataset , [ citationMetadataBlock ] )
820857
@@ -855,6 +892,12 @@ describe('DatasetsRepository', () => {
855892 ( actualUpdatedDataset . metadataBlocks [ 0 ] . fields . dsDescription [ 0 ] as DatasetDescription )
856893 . dsDescriptionValue
857894 ) . toBe ( updatedDsDescription )
895+ expect ( actualUpdatedDataset . metadataBlocks [ 0 ] . fields . notesText as string ) . toBe ( undefined )
896+ expect ( actualUpdatedDataset . metadataBlocks [ 0 ] . fields . publication ) . toStrictEqual ( [
897+ {
898+ publicationCitation : 'Some updated related publication citation'
899+ }
900+ ] )
858901 } )
859902
860903 test ( 'should return error when dataset does not exist' , async ( ) => {
0 commit comments