-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #502 from IQSS/fix/501-update-e2e-test
Fix/501 update e2e test
- Loading branch information
Showing
2 changed files
with
7 additions
and
88 deletions.
There are no files selected for viewing
84 changes: 0 additions & 84 deletions
84
tests/e2e-integration/integration/metadata-block-info/MetadataBlockInfoCitationExample.ts
This file was deleted.
Oops, something went wrong.
11 changes: 7 additions & 4 deletions
11
...ntegration/integration/metadata-block-info/MetadataBlockInfoJSDataverseRepository.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,27 @@ | ||
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 () => { | ||
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).to.deep.equal(metadataBlockInfoExpected) | ||
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') | ||
}) | ||
}) | ||
}) | ||
}) |