From 40faf13eb55fa85dc82c0f837fdfd2922acc85f3 Mon Sep 17 00:00:00 2001 From: Ellen Kraffmiller Date: Mon, 23 Sep 2024 16:46:55 -0400 Subject: [PATCH 1/3] fix: update MetadataBlockInfoCitationExample.ts --- .../metadata-block-info/MetadataBlockInfoCitationExample.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/e2e-integration/integration/metadata-block-info/MetadataBlockInfoCitationExample.ts b/tests/e2e-integration/integration/metadata-block-info/MetadataBlockInfoCitationExample.ts index 4b7f621c9..07e1b6591 100644 --- a/tests/e2e-integration/integration/metadata-block-info/MetadataBlockInfoCitationExample.ts +++ b/tests/e2e-integration/integration/metadata-block-info/MetadataBlockInfoCitationExample.ts @@ -23,14 +23,15 @@ export const MetadataBlockInfoCitationExample = { subject: { displayFormat: '' }, keyword: { displayFormat: '' }, keywordValue: { displayFormat: '#VALUE' }, + keywordTermURI: { displayFormat: '[#VALUE](#VALUE)' }, keywordVocabulary: { displayFormat: '(#VALUE)' }, keywordVocabularyURI: { displayFormat: '[#VALUE](#VALUE)' }, - keywordTermURI: { displayFormat: '[#VALUE](#VALUE)' }, topicClassification: { displayFormat: '' }, topicClassValue: { displayFormat: '#VALUE' }, topicClassVocab: { displayFormat: '(#VALUE)' }, topicClassVocabURI: { displayFormat: '[#VALUE](#VALUE)' }, publication: { displayFormat: '' }, + publicationRelationType: { displayFormat: '#VALUE:' }, publicationCitation: { displayFormat: '#VALUE' }, publicationIDType: { displayFormat: '#VALUE: ' }, publicationIDNumber: { displayFormat: '#VALUE' }, From 81c1edd2fcc351dc78b3915e8cdf1fa4dc821f74 Mon Sep 17 00:00:00 2001 From: Ellen Kraffmiller Date: Mon, 23 Sep 2024 17:16:52 -0400 Subject: [PATCH 2/3] test: add test of the JSON that allows for dynamic content --- .../MetadataBlockInfoJSDataverseRepository.spec.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/e2e-integration/integration/metadata-block-info/MetadataBlockInfoJSDataverseRepository.spec.ts b/tests/e2e-integration/integration/metadata-block-info/MetadataBlockInfoJSDataverseRepository.spec.ts index 22b9543f6..aa494f78a 100644 --- a/tests/e2e-integration/integration/metadata-block-info/MetadataBlockInfoJSDataverseRepository.spec.ts +++ b/tests/e2e-integration/integration/metadata-block-info/MetadataBlockInfoJSDataverseRepository.spec.ts @@ -21,4 +21,17 @@ describe('Metadata Block Info JSDataverse Repository', () => { expect(metadataBlockInfo).to.deep.equal(metadataBlockInfoExpected) }) }) + it('returns JSON in the correct format', async () => { + await metadataBlockInfoRepository.getByName('citation').then((metadataBlockInfo) => { + if (!metadataBlockInfo) { + throw new Error('Metadata Block Info not found') + } + expect(metadataBlockInfo['name']).to.equal('citation') + expect(metadataBlockInfo['fields']).to.be.an('object') + Object.keys(metadataBlockInfo['fields']).forEach((field) => { + expect(metadataBlockInfo['fields'][field]).to.be.an('object') + expect(metadataBlockInfo['fields'][field]['displayFormat']).to.be.a('string') + }) + }) + }) }) From 7edf304f7aae5b8040b7b59774eb53e8807028c0 Mon Sep 17 00:00:00 2001 From: Ellen Kraffmiller Date: Tue, 24 Sep 2024 08:55:06 -0400 Subject: [PATCH 3/3] test: remove test of exact fields in JSON --- .../MetadataBlockInfoCitationExample.ts | 85 ------------------- ...dataBlockInfoJSDataverseRepository.spec.ts | 10 --- 2 files changed, 95 deletions(-) delete mode 100644 tests/e2e-integration/integration/metadata-block-info/MetadataBlockInfoCitationExample.ts diff --git a/tests/e2e-integration/integration/metadata-block-info/MetadataBlockInfoCitationExample.ts b/tests/e2e-integration/integration/metadata-block-info/MetadataBlockInfoCitationExample.ts deleted file mode 100644 index 07e1b6591..000000000 --- a/tests/e2e-integration/integration/metadata-block-info/MetadataBlockInfoCitationExample.ts +++ /dev/null @@ -1,85 +0,0 @@ -export const MetadataBlockInfoCitationExample = { - name: 'citation', - fields: { - title: { displayFormat: '' }, - subtitle: { displayFormat: '' }, - alternativeTitle: { displayFormat: '' }, - alternativeURL: { displayFormat: '[#VALUE](#VALUE)' }, - otherId: { displayFormat: ':' }, - otherIdAgency: { displayFormat: '#VALUE' }, - otherIdValue: { displayFormat: '#VALUE' }, - author: { displayFormat: '' }, - authorName: { displayFormat: '#VALUE' }, - authorAffiliation: { displayFormat: '(#VALUE)' }, - authorIdentifierScheme: { displayFormat: '- #VALUE:' }, - authorIdentifier: { displayFormat: '#VALUE' }, - datasetContact: { displayFormat: '' }, - datasetContactName: { displayFormat: '#VALUE' }, - datasetContactAffiliation: { displayFormat: '(#VALUE)' }, - datasetContactEmail: { displayFormat: '[#VALUE](mailto:#VALUE)' }, - dsDescription: { displayFormat: '' }, - dsDescriptionValue: { displayFormat: '#VALUE' }, - dsDescriptionDate: { displayFormat: '(#VALUE)' }, - subject: { displayFormat: '' }, - keyword: { displayFormat: '' }, - keywordValue: { displayFormat: '#VALUE' }, - keywordTermURI: { displayFormat: '[#VALUE](#VALUE)' }, - keywordVocabulary: { displayFormat: '(#VALUE)' }, - keywordVocabularyURI: { displayFormat: '[#VALUE](#VALUE)' }, - topicClassification: { displayFormat: '' }, - topicClassValue: { displayFormat: '#VALUE' }, - topicClassVocab: { displayFormat: '(#VALUE)' }, - topicClassVocabURI: { displayFormat: '[#VALUE](#VALUE)' }, - publication: { displayFormat: '' }, - publicationRelationType: { displayFormat: '#VALUE:' }, - publicationCitation: { displayFormat: '#VALUE' }, - publicationIDType: { displayFormat: '#VALUE: ' }, - publicationIDNumber: { displayFormat: '#VALUE' }, - publicationURL: { displayFormat: '[#VALUE](#VALUE)' }, - notesText: { displayFormat: '' }, - language: { displayFormat: '' }, - producer: { displayFormat: '' }, - producerName: { displayFormat: '#VALUE' }, - producerAffiliation: { displayFormat: '(#VALUE)' }, - producerAbbreviation: { displayFormat: '(#VALUE)' }, - producerURL: { displayFormat: '[#VALUE](#VALUE)' }, - producerLogoURL: { displayFormat: '![#NAME](#VALUE)' }, - productionDate: { displayFormat: '' }, - productionPlace: { displayFormat: '' }, - contributor: { displayFormat: ':' }, - contributorType: { displayFormat: '#VALUE ' }, - contributorName: { displayFormat: '#VALUE' }, - grantNumber: { displayFormat: ':' }, - grantNumberAgency: { displayFormat: '#VALUE' }, - grantNumberValue: { displayFormat: '#VALUE' }, - distributor: { displayFormat: '' }, - distributorName: { displayFormat: '#VALUE' }, - distributorAffiliation: { displayFormat: '(#VALUE)' }, - distributorAbbreviation: { displayFormat: '(#VALUE)' }, - distributorURL: { displayFormat: '[#VALUE](#VALUE)' }, - distributorLogoURL: { displayFormat: '![#NAME](#VALUE)' }, - distributionDate: { displayFormat: '' }, - depositor: { displayFormat: '' }, - dateOfDeposit: { displayFormat: '' }, - timePeriodCovered: { displayFormat: ';' }, - timePeriodCoveredStart: { displayFormat: '#NAME: #VALUE ' }, - timePeriodCoveredEnd: { displayFormat: '#NAME: #VALUE ' }, - dateOfCollection: { displayFormat: ';' }, - dateOfCollectionStart: { displayFormat: '#NAME: #VALUE ' }, - dateOfCollectionEnd: { displayFormat: '#NAME: #VALUE ' }, - kindOfData: { displayFormat: '' }, - series: { displayFormat: ':' }, - seriesName: { displayFormat: '#VALUE' }, - seriesInformation: { displayFormat: '#VALUE' }, - software: { displayFormat: ',' }, - softwareName: { displayFormat: '#VALUE' }, - softwareVersion: { displayFormat: '#NAME: #VALUE' }, - relatedMaterial: { displayFormat: '' }, - relatedDatasets: { displayFormat: '' }, - otherReferences: { displayFormat: '' }, - dataSources: { displayFormat: '' }, - originOfSources: { displayFormat: '' }, - characteristicOfSources: { displayFormat: '' }, - accessToSources: { displayFormat: '' } - } -} diff --git a/tests/e2e-integration/integration/metadata-block-info/MetadataBlockInfoJSDataverseRepository.spec.ts b/tests/e2e-integration/integration/metadata-block-info/MetadataBlockInfoJSDataverseRepository.spec.ts index aa494f78a..7fcc2184b 100644 --- a/tests/e2e-integration/integration/metadata-block-info/MetadataBlockInfoJSDataverseRepository.spec.ts +++ b/tests/e2e-integration/integration/metadata-block-info/MetadataBlockInfoJSDataverseRepository.spec.ts @@ -1,26 +1,16 @@ import chai from 'chai' import chaiAsPromised from 'chai-as-promised' import { MetadataBlockInfoJSDataverseRepository } from '../../../../src/metadata-block-info/infrastructure/repositories/MetadataBlockInfoJSDataverseRepository' -import { MetadataBlockInfoCitationExample } from './MetadataBlockInfoCitationExample' import { TestsUtils } from '../../shared/TestsUtils' chai.use(chaiAsPromised) const expect = chai.expect -const metadataBlockInfoExpected = MetadataBlockInfoCitationExample const metadataBlockInfoRepository = new MetadataBlockInfoJSDataverseRepository() describe('Metadata Block Info JSDataverse Repository', () => { before(() => TestsUtils.setup()) beforeEach(() => TestsUtils.login()) - it('gets the metadataBlockInfo by name', async () => { - await metadataBlockInfoRepository.getByName('citation').then((metadataBlockInfo) => { - if (!metadataBlockInfo) { - throw new Error('Metadata Block Info not found') - } - expect(metadataBlockInfo).to.deep.equal(metadataBlockInfoExpected) - }) - }) it('returns JSON in the correct format', async () => { await metadataBlockInfoRepository.getByName('citation').then((metadataBlockInfo) => { if (!metadataBlockInfo) {