From bf9e6d8be4b2a644eabc2f612e2b0a765491fc76 Mon Sep 17 00:00:00 2001 From: German Gonzalo Saracca Date: Fri, 13 Sep 2024 18:29:00 +0000 Subject: [PATCH] reverting unwanted changes --- .../shared/form/DatasetMetadataForm/MetadataForm/index.tsx | 5 ++--- .../dataset-metadata-form/DatasetMetadataForm.spec.tsx | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/sections/shared/form/DatasetMetadataForm/MetadataForm/index.tsx b/src/sections/shared/form/DatasetMetadataForm/MetadataForm/index.tsx index 460538ec8..6c63c3aad 100644 --- a/src/sections/shared/form/DatasetMetadataForm/MetadataForm/index.tsx +++ b/src/sections/shared/form/DatasetMetadataForm/MetadataForm/index.tsx @@ -58,9 +58,8 @@ export const MetadataForm = ({ useEffect(() => { // Only on create mode, lets prefill specific fields with user data if (mode === 'create' && user) { - const displayName = `${user.lastName}, ${user.firstName}` - setValue('citation.author.0.authorName', displayName) - setValue('citation.datasetContact.0.datasetContactName', displayName) + setValue('citation.author.0.authorName', user.displayName) + setValue('citation.datasetContact.0.datasetContactName', user.displayName) setValue('citation.datasetContact.0.datasetContactEmail', user.email, { shouldValidate: true }) diff --git a/tests/component/sections/shared/dataset-metadata-form/DatasetMetadataForm.spec.tsx b/tests/component/sections/shared/dataset-metadata-form/DatasetMetadataForm.spec.tsx index 4a1bac3f6..cff76feda 100644 --- a/tests/component/sections/shared/dataset-metadata-form/DatasetMetadataForm.spec.tsx +++ b/tests/component/sections/shared/dataset-metadata-form/DatasetMetadataForm.spec.tsx @@ -1445,7 +1445,6 @@ describe('DatasetMetadataForm', () => { }) it('pre-fills the form with user data', () => { - const displayName = `${testUser.lastName}, ${testUser.firstName}` cy.mountAuthenticated( { cy.findByText('Author') .closest('.row') .within(() => { - cy.findByLabelText(/^Name/i).should('have.value', displayName) + cy.findByLabelText(/^Name/i).should('have.value', testUser.displayName) }) cy.findByText('Author') .closest('.row') @@ -1467,7 +1466,7 @@ describe('DatasetMetadataForm', () => { cy.findByText('Point of Contact') .closest('.row') .within(() => { - cy.findByLabelText(/^Name/i).should('have.value', displayName) + cy.findByLabelText(/^Name/i).should('have.value', testUser.displayName) }) cy.findByText('Point of Contact') .closest('.row')