diff --git a/app/presenters/licences/licence-set-up.presenter.js b/app/presenters/licences/licence-set-up.presenter.js index a22c6c5418..466f1e8af0 100644 --- a/app/presenters/licences/licence-set-up.presenter.js +++ b/app/presenters/licences/licence-set-up.presenter.js @@ -43,18 +43,18 @@ function _chargeInformation (chargeVersions, workflows, auth) { ] } -function _chargeVersions (licenceSetUp) { - return licenceSetUp.map((chargeInformation) => { +function _chargeVersions (chargeVersions) { + return chargeVersions.map((chargeVersion) => { return { - id: chargeInformation.id, - startDate: chargeInformation.startDate ? formatLongDate(chargeInformation.startDate) : '-', - endDate: chargeInformation.endDate ? formatLongDate(chargeInformation.endDate) : '-', - status: _status(chargeInformation.status), - reason: chargeInformation.changeReason?.description, + id: chargeVersion.id, + startDate: chargeVersion.startDate ? formatLongDate(chargeVersion.startDate) : '-', + endDate: chargeVersion.endDate ? formatLongDate(chargeVersion.endDate) : '-', + status: _status(chargeVersion.status), + reason: chargeVersion.changeReason?.description, action: [ { text: 'View', - link: `/licences/${chargeInformation.licenceId}/charge-information/${chargeInformation.id}/view` + link: `/licences/${chargeVersion.licenceId}/charge-information/${chargeVersion.id}/view` } ] } diff --git a/app/services/licences/fetch-workflows.service.js b/app/services/licences/fetch-workflows.service.js index c375df624b..946ccc07e2 100644 --- a/app/services/licences/fetch-workflows.service.js +++ b/app/services/licences/fetch-workflows.service.js @@ -1,18 +1,16 @@ 'use strict' /** - * Fetches data needed for the view '/licences/{id}/licence-set-up` page + * Fetches workflow data needed for the view '/licences/{id}/set-up` page * @module FetchWorkflowsService */ const WorkflowModel = require('../../models/workflow.model.js') /** - * Fetch the matching licence and return data needed for the view licence set up page + * Fetches charge version data needed for the view '/licences/{id}/set-up` page * - * Was built to provide the data needed for the '/licences/{id}/licence-set-up' page - * - * @param {string} licenceId The string for the licence to fetch + * @param {string} licenceId - The UUID for the licence to fetch workflow data for * * @returns {Promise} the data needed to populate the view licence page's set up tab */ diff --git a/test/services/licences/fetch-charge-versions.service.test.js b/test/services/licences/fetch-charge-versions.service.test.js index 72f7e4ca1e..4a2c24c8e3 100644 --- a/test/services/licences/fetch-charge-versions.service.test.js +++ b/test/services/licences/fetch-charge-versions.service.test.js @@ -15,7 +15,7 @@ const ChangeReasonHelper = require('../../support/helpers/change-reason.helper.j const FetchChargeVersionsService = require('../../../app/services/licences/fetch-charge-versions.service.js') -describe('Fetch charge versions for a licence', () => { +describe('Fetch Charge Versions service', () => { let testRecord beforeEach(async () => { diff --git a/test/services/licences/fetch-workflows.service.test.js b/test/services/licences/fetch-workflows.service.test.js index 92d997cd57..0a74b3bd35 100644 --- a/test/services/licences/fetch-workflows.service.test.js +++ b/test/services/licences/fetch-workflows.service.test.js @@ -14,7 +14,7 @@ const WorkflowHelper = require('../../support/helpers/workflow.helper.js') const FetchWorkflowsService = require('../../../app/services/licences/fetch-workflows.service.js') -describe('Fetch workflows for a licence', () => { +describe('Fetch Workflows service', () => { let testRecord beforeEach(async () => {