Skip to content

Commit

Permalink
Merge pull request #7420 from uktrade/fix/omis-order-quote-accepted-by
Browse files Browse the repository at this point in the history
Render OMIS order quote `accepted_by` only if defined
  • Loading branch information
paulgain authored Dec 20, 2024
2 parents 6e0e245 + 783eb59 commit 6d45f0e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/client/modules/Omis/OrderQuote.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@ const AcceptedOn = ({ quote }) => (
{formatDate(quote.acceptedOn, DATE_FORMAT_MEDIUM_WITH_TIME)}
</StyledP>
<StyledHeading data-test="accepted-by-heading">Accepted by</StyledHeading>
<StyledP data-test="accepted-by-name">{quote.acceptedBy.name}</StyledP>
{quote.acceptedBy && (
<StyledP data-test="accepted-by-name">{quote.acceptedBy.name}</StyledP>
)}
</>
)

Expand Down
7 changes: 7 additions & 0 deletions test/functional/cypress/specs/omis/quote-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,13 @@ describe('Order quote', () => {
})
})

context('When the quote has been accepted, but accepted_by is null', () => {
it('should not render accepted-by-name', () => {
cy.visit(urls.omis.quote(quoteAccepted.id))
cy.get('[data-test="accepted-by-name"]').should('not.exist')
})
})

context('When the order has been cancelled', () => {
beforeEach(() => {
cy.visit(urls.omis.quote(cancelledOrder.id))
Expand Down

0 comments on commit 6d45f0e

Please sign in to comment.