From 4e3a9febf0a4b6b898a21f0f41985a9d7c333434 Mon Sep 17 00:00:00 2001 From: Pippo Raimondi Date: Thu, 7 Mar 2024 09:41:39 +0000 Subject: [PATCH] Add export potential mapping back and include export potential last updated --- .../Companies/CompanyExports/ExportsEdit.jsx | 13 ++++++++++-- .../Companies/CompanyExports/ExportsIndex.jsx | 14 +++++++++++-- .../Companies/CompanyExports/labels.js | 1 + .../Companies/CompanyExports/transformers.js | 6 ++++++ .../cypress/specs/DIT/companies-spec.js | 21 ++++++++++++------- .../specs/companies/export/edit-spec.js | 6 ++++-- .../specs/companies/export/index-spec.js | 6 ++++-- .../fixtures/v4/company/company-dnb-ltd.json | 1 + 8 files changed, 53 insertions(+), 15 deletions(-) diff --git a/src/client/modules/Companies/CompanyExports/ExportsEdit.jsx b/src/client/modules/Companies/CompanyExports/ExportsEdit.jsx index 72d8ba57dc4..4b885d63d37 100644 --- a/src/client/modules/Companies/CompanyExports/ExportsEdit.jsx +++ b/src/client/modules/Companies/CompanyExports/ExportsEdit.jsx @@ -16,6 +16,10 @@ import { ExportExperienceCategoriesResource, } from '../../../components/Resource' import { transformArrayIdNameToValueLabel } from '../../../transformers' +import { + buildExportPotential, + buildExportPotentialLastModified, +} from './transformers' import { exportDetailsLabels } from './labels' import { buildCompanyBreadcrumbs } from '../utils' @@ -77,9 +81,14 @@ const ExportsEdit = () => { }} /> - {exportDetailsLabels.exportPotential} - Unavailable + {buildExportPotential(company)} + + {exportDetailsLabels.lastModifiedPotential} + + + {buildExportPotentialLastModified(company)} + { heading={exportDetailsLabels.exportPotential} key={exportDetailsLabels.exportPotential} > - Unavailable + {buildExportPotential(company)} + + + {buildExportPotentialLastModified(company)} diff --git a/src/client/modules/Companies/CompanyExports/labels.js b/src/client/modules/Companies/CompanyExports/labels.js index a2c86669fa4..1c05e1ec686 100644 --- a/src/client/modules/Companies/CompanyExports/labels.js +++ b/src/client/modules/Companies/CompanyExports/labels.js @@ -5,6 +5,7 @@ export const exportDetailsLabels = { noInterestCountries: 'Countries of no interest', greatProfile: 'great.gov.uk business profile', exportPotential: 'Export potential', + lastModifiedPotential: 'Export potential last updated', } export const exportPotentialLabels = { diff --git a/src/client/modules/Companies/CompanyExports/transformers.js b/src/client/modules/Companies/CompanyExports/transformers.js index 58788d6ec9b..40cc3c6efaa 100644 --- a/src/client/modules/Companies/CompanyExports/transformers.js +++ b/src/client/modules/Companies/CompanyExports/transformers.js @@ -10,6 +10,12 @@ export const buildExportPotential = (company) => { : 'No score given' } +export const buildExportPotentialLastModified = (company) => { + return company.lastModifiedPotential + ? new Date(company.lastModifiedPotential).toISOString().split('T')[0] + : 'No score given' +} + export const transformCountriesForTypeahead = (exportCountries) => { const groupedExportCountries = groupExportCountries(exportCountries) return [ diff --git a/test/end-to-end/cypress/specs/DIT/companies-spec.js b/test/end-to-end/cypress/specs/DIT/companies-spec.js index a347301fa92..bc140513164 100644 --- a/test/end-to-end/cypress/specs/DIT/companies-spec.js +++ b/test/end-to-end/cypress/specs/DIT/companies-spec.js @@ -94,7 +94,8 @@ describe('Export', () => { assertTable([ 'Export growth', 'No profile', - 'Unavailable', + 'No score given', + 'No score given', 'None', 'None', 'None', @@ -112,7 +113,8 @@ describe('Export', () => { assertTable([ 'None', 'No profile', - 'Unavailable', + 'No score given', + 'No score given', 'None', 'None', 'None', @@ -152,7 +154,8 @@ describe('Export', () => { assertTable([ 'None', 'No profile', - 'Unavailable', + 'No score given', + 'No score given', 'None', 'None', 'None', @@ -175,7 +178,8 @@ describe('Export', () => { assertTable([ 'None', 'No profile', - 'Unavailable', + 'No score given', + 'No score given', 'France, Germany', 'None', 'None', @@ -191,7 +195,8 @@ describe('Export', () => { assertTable([ 'None', 'No profile', - 'Unavailable', + 'No score given', + 'No score given', 'France, Germany', 'None', 'None', @@ -218,7 +223,8 @@ describe('Export', () => { assertTable([ 'None', 'No profile', - 'Unavailable', + 'No score given', + 'No score given', 'Brazil, France, Germany', 'Honduras', 'Chile', @@ -245,7 +251,8 @@ describe('Export', () => { assertTable([ 'None', 'No profile', - 'Unavailable', + 'No score given', + 'No score given', 'None', 'None', 'None', diff --git a/test/functional/cypress/specs/companies/export/edit-spec.js b/test/functional/cypress/specs/companies/export/edit-spec.js index 62aa9093783..2abb03b9472 100644 --- a/test/functional/cypress/specs/companies/export/edit-spec.js +++ b/test/functional/cypress/specs/companies/export/edit-spec.js @@ -62,7 +62,8 @@ describe('Company Export tab - Edit exports', () => { label: 'great.gov.uk business profile', value: 'No profile', }, - { label: 'Export potential', value: 'Unavailable' }, + { label: 'Export potential', value: 'No score given' }, + { label: 'Export potential last updated', value: 'No score given' }, ]) }) @@ -111,7 +112,8 @@ describe('Company Export tab - Edit exports', () => { label: 'great.gov.uk business profile', value: '"Find a supplier" profile (opens in new tab)', }, - { label: 'Export potential', value: 'Unavailable' }, + { label: 'Export potential', value: 'Medium' }, + { label: 'Export potential last updated', value: '2024-03-07' }, ]) cy.contains('"Find a supplier" profile').should( diff --git a/test/functional/cypress/specs/companies/export/index-spec.js b/test/functional/cypress/specs/companies/export/index-spec.js index 50d3f545c2d..fdd2f5b06a1 100644 --- a/test/functional/cypress/specs/companies/export/index-spec.js +++ b/test/functional/cypress/specs/companies/export/index-spec.js @@ -79,7 +79,8 @@ describe('Company Export tab', () => { assertExportsTable(fixtures.company.dnbCorp.id, [ { label: 'Export win category', value: 'None' }, { label: 'great.gov.uk business profile', value: 'No profile' }, - { label: 'Export potential', value: 'Unavailable' }, + { label: 'Export potential', value: 'No score given' }, + { label: 'Export potential last updated', value: 'No score given' }, ]) }) @@ -261,7 +262,8 @@ describe('Company Export tab', () => { value: '"Find a supplier" profile (opens in new tab)', }, - { label: 'Export potential', value: 'Unavailable' }, + { label: 'Export potential', value: 'Medium' }, + { label: 'Export potential last updated', value: '2024-03-07' }, ]) cy.contains('"Find a supplier" profile').should( diff --git a/test/sandbox/fixtures/v4/company/company-dnb-ltd.json b/test/sandbox/fixtures/v4/company/company-dnb-ltd.json index e34b6552c6c..e72cc3551ce 100644 --- a/test/sandbox/fixtures/v4/company/company-dnb-ltd.json +++ b/test/sandbox/fixtures/v4/company/company-dnb-ltd.json @@ -35,6 +35,7 @@ "is_number_of_employees_estimated": true, "great_profile_status": "published", "export_potential": "medium", + "last_modified_potential": "2024-03-07", "export_countries": [ { "country": {