Skip to content

Commit

Permalink
handle optional fields in unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
rosado committed Dec 12, 2024
1 parent 3ddadc4 commit cb037fb
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions test/unit/http-errorPage.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,14 @@ describe(`http-error.html(seed: ${seed})`, () => {
}

expect(rows[2].querySelector('.govuk-summary-list__key').textContent).toContain('Last attempted access')
expect(rows[2].querySelector('.govuk-summary-list__value').textContent).toMatch(dateRegex)
if (params.errorData.latest_log_entry_date) {
expect(rows[2].querySelector('.govuk-summary-list__value').textContent).toMatch(dateRegex)
}

expect(rows[3].querySelector('.govuk-summary-list__key').textContent).toContain('Last successful access')
expect(rows[3].querySelector('.govuk-summary-list__value').textContent).toMatch(dateRegex)
if (params.errorData.latest_200_date) {
expect(rows[3].querySelector('.govuk-summary-list__value').textContent).toMatch(dateRegex)
}
})

it('re-submit link points to get-started page', () => {
Expand Down

0 comments on commit cb037fb

Please sign in to comment.