Skip to content

Commit

Permalink
fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Romuald Caplier committed Sep 23, 2024
1 parent 0b997c1 commit ac45c41
Show file tree
Hide file tree
Showing 7 changed files with 202 additions and 165 deletions.
2 changes: 0 additions & 2 deletions libs/api/metadata-converter/src/lib/iso19139/read-parts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,6 @@ export function readAbstract(rootEl: XmlElement): string {
}

export function readContacts(rootEl: XmlElement): Individual[] {
console.log('converter : readContacts')
return pipe(
findChildrenElement('gmd:contact', false),
mapArray(findChildElement('gmd:CI_ResponsibleParty', false)),
Expand All @@ -609,7 +608,6 @@ export function readContacts(rootEl: XmlElement): Individual[] {
}

export function readContactsForResource(rootEl: XmlElement): Individual[] {
console.log('converter : readContactsForResource')
return pipe(
findIdentification(),
combine(
Expand Down
2 changes: 0 additions & 2 deletions libs/api/metadata-converter/src/lib/iso19139/write-parts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,6 @@ export function writeStatus(record: DatasetRecord, rootEl: XmlElement) {
}

export function writeContacts(record: CatalogRecord, rootEl: XmlElement) {
console.log('converter : writeContacts')
pipe(
removeChildrenByName('gmd:contact'),
appendChildren(
Expand All @@ -797,7 +796,6 @@ export function writeContactsForResource(
record: CatalogRecord,
rootEl: XmlElement
) {
console.log('converter : writeContactsForResource')
pipe(
findOrCreateIdentification(),
removeChildrenByName('gmd:pointOfContact'),
Expand Down
1 change: 1 addition & 0 deletions libs/common/fixtures/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export * from './lib/record-link.fixtures'
export * from './lib/records.fixtures'
export * from './lib/repository.fixtures'
export * from './lib/user.fixtures'
export * from './lib/individual.fixtures'
export * from './lib/user-feedbacks.fixtures'

export * from './lib/editor'
Expand Down
61 changes: 61 additions & 0 deletions libs/common/fixtures/src/lib/individual.fixtures.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import { Individual } from '@geonetwork-ui/common/domain/model/record'
import { barbieIncOrganizationFixture } from './organisations.fixture'

export const createIndividualFixture = (
overrides: Partial<Individual> = {}
): Individual => ({
firstName: 'Arnaud',
lastName: 'Demaison',
email: '[email protected]',
organization: barbieIncOrganizationFixture(),
role: 'point_of_contact',
...overrides,
})

export const barbieIndividualFixture = (): Individual =>
createIndividualFixture({
firstName: 'Barbara',
lastName: 'Roberts',
email: '[email protected]',
organization: barbieIncOrganizationFixture(),
role: 'point_of_contact',
})

export const someIndividualsFixture = (): Individual[] => [
barbieIndividualFixture(),
{
firstName: 'John',
lastName: 'Doe',
email: '[email protected]',
organization: barbieIncOrganizationFixture(),
role: 'owner',
},
{
firstName: 'Alice',
lastName: 'Smith',
email: '[email protected]',
organization: barbieIncOrganizationFixture(),
role: 'author',
},
{
firstName: 'Michael',
lastName: 'Johnson',
email: '[email protected]',
organization: barbieIncOrganizationFixture(),
role: 'contributor',
},
{
firstName: 'Emma',
lastName: 'Williams',
email: '[email protected]',
organization: barbieIncOrganizationFixture(),
role: 'rights_holder',
},
{
firstName: 'David',
lastName: 'Brown',
email: '[email protected]',
organization: barbieIncOrganizationFixture(),
role: 'stakeholder',
},
]
13 changes: 13 additions & 0 deletions libs/common/fixtures/src/lib/user.fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,19 @@ export const barbieUserFixture = (): UserModel =>
'https://www.gravatar.com/avatar/dbdffd183622800bcf8587328daf43a6?d=mp',
})

export const johnDoeUserFixture = (): UserModel =>
createUserFixture({
id: '12345',
profile: 'User',
username: 'johndoe',
name: 'John',
surname: 'Doe',
email: '[email protected]',
organisation: 'Doe Enterprises',
profileIcon:
'https://www.gravatar.com/avatar/5f6d74eabcb57186a12f7c8ba40b4c9f?d=mp',
})

export const ghostUserFixture = (): UserModel =>
createUserFixture({
id: '161',
Expand Down
Loading

0 comments on commit ac45c41

Please sign in to comment.