Skip to content

Commit

Permalink
Fix contact local header component tests
Browse files Browse the repository at this point in the history
  • Loading branch information
paulgain committed Dec 17, 2024
1 parent 07368df commit 07b69c7
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/client/components/ContactLocalHeader/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ const ContactLocalHeader = ({ contact, writeFlashMessage }) => {
</GridRow>
{contact.archived && (
<ArchivePanel
archivedBy={contact.archivedBy ? contact.archivedBy : ''}
archivedOn={contact.archivedOn ? contact.archivedOn : ''}
archiveReason={contact.archivedReason}
archivedBy={contact.archived_by}
archivedOn={contact.archived_on}
archiveReason={contact.archived_reason}
unarchiveUrl={urls.contacts.unarchive(contact.id)}
onClick={() => {
writeFlashMessage('Contact record updated')
Expand Down
14 changes: 14 additions & 0 deletions test/component/cypress/specs/Contacts/ContactLocalHeader.cy.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,20 @@ describe('ContactLocalHeader', () => {
it('should render the archive panel', () => {
cy.get('[data-test=archive-panel]').should('exist')
})

it('should render an archived message', () => {
cy.get('[data-test="archive-message"]').should(
'have.text',
'This contact was archived on 04 Jul 2019 by Bernard Harris-Patel.'
)
})

it('should render an archived reason', () => {
cy.get('[data-test="archive-reason"]').should(
'have.text',
'Reason: Left the company'
)
})
})
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
"accepts_dit_email_marketing":true,
"archived":false,
"archived_documents_url_path":"/document/123",
"archived_on":null,
"archived_on":"2019-02-04T15:59:14.2Z",
"archived_reason":null,
"archived_by":null,
"archived_by":"2019-02-04T15:59:14.267412Z",
"created_on":"2019-02-04T15:59:14.267412Z",
"modified_on":"2019-02-05T13:17:23.112153Z"
}

0 comments on commit 07b69c7

Please sign in to comment.