Skip to content

Commit

Permalink
add back in test and fix
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeGoodall committed Jan 16, 2025
1 parent 6779904 commit a8a4918
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/unit/middleware/overview.middleware.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,23 @@ describe('overview.middleware', () => {
expect(errorCardNodes[0].querySelector('.govuk-task-list__hint').textContent.trim()).toBe('There was an error accessing the data URL')
expect(errorCardNodes[1].querySelector('.govuk-task-list__hint').textContent.trim()).toBe('There was a 404 error')
})

it('should patch dataset status based on the provision_summary info', () => {
const req = structuredClone(reqTemplate)
console.assert(req.datasets[0].status === 'Live')
req.datasetErrorStatus = [{ dataset: 'dataset1' }]
const res = { render: vi.fn() }

prepareOverviewTemplateParams(req, res, () => {})

const ds1 = req.templateParams.datasets.statutory[0]
expect(ds1.status).toBe('Live')
expect(ds1.error).toBeUndefined()

const ds4 = req.templateParams.datasets.other[1]
expect(ds4.status).toBe('Error')
expect(ds4.error).toBe(req.datasets[3].error) // Error message should be left untouched
})
})

describe('getOverview', () => {
Expand Down

0 comments on commit a8a4918

Please sign in to comment.