diff --git a/src/client/components/Resource/ExportWins.js b/src/client/components/Resource/ExportWins.js index 0f7d466438b..8dd88cac7f3 100644 --- a/src/client/components/Resource/ExportWins.js +++ b/src/client/components/Resource/ExportWins.js @@ -1,3 +1,3 @@ import { createCollectionResource } from './Resource' -export default createCollectionResource('Export wins', 'v4/export-win') +export default createCollectionResource('Export Wins', 'v4/export-win') diff --git a/src/client/components/Resource/Paginated.js b/src/client/components/Resource/Paginated.js index 526e03fded6..4f7b7df2e7c 100644 --- a/src/client/components/Resource/Paginated.js +++ b/src/client/components/Resource/Paginated.js @@ -80,6 +80,7 @@ const PaginatedResource = multiInstance({ }), component: ({ name, + heading, id, children, pageSize = 10, @@ -129,7 +130,7 @@ const PaginatedResource = multiInstance({ {totalPages > 0 && ( diff --git a/src/client/modules/ExportWins/Status/WinsRejectedList.jsx b/src/client/modules/ExportWins/Status/WinsRejectedList.jsx index c735720137a..88d6f0bf7a1 100644 --- a/src/client/modules/ExportWins/Status/WinsRejectedList.jsx +++ b/src/client/modules/ExportWins/Status/WinsRejectedList.jsx @@ -10,6 +10,7 @@ import urls from '../../../../lib/urls' export default () => ( diff --git a/src/client/modules/ExportWins/Status/WinsSentList.jsx b/src/client/modules/ExportWins/Status/WinsSentList.jsx index 6826957889e..f9d65bb0eb6 100644 --- a/src/client/modules/ExportWins/Status/WinsSentList.jsx +++ b/src/client/modules/ExportWins/Status/WinsSentList.jsx @@ -10,6 +10,7 @@ import urls from '../../../../lib/urls' export default () => ( diff --git a/src/client/modules/ExportWins/Status/WinsWonTable.jsx b/src/client/modules/ExportWins/Status/WinsWonTable.jsx index 797dc1fe46a..ce2ccf792a9 100644 --- a/src/client/modules/ExportWins/Status/WinsWonTable.jsx +++ b/src/client/modules/ExportWins/Status/WinsWonTable.jsx @@ -69,6 +69,7 @@ export const WinsWonTable = ({ exportWins }) => { export default () => ( diff --git a/test/functional/cypress/specs/export-win/add-export-win-spec.js b/test/functional/cypress/specs/export-win/add-export-win-spec.js index 25ea70f2c16..714c0f227ab 100644 --- a/test/functional/cypress/specs/export-win/add-export-win-spec.js +++ b/test/functional/cypress/specs/export-win/add-export-win-spec.js @@ -446,14 +446,14 @@ describe('Adding an export win', () => { it('should display validation error messages on mandatory fields', () => { clickContinueButton() assertErrorSummary([ - 'Select a contact', + 'Select a company contact', 'Select HQ location', 'Select export potential', 'Select export experience', ]) assertFieldError( cy.get(customerDetails.contacts), - 'Select a contact', + 'Select a company contact', true ) assertFieldError( @@ -733,6 +733,36 @@ describe('Adding an export win', () => { ) assertFieldError(cy.get(winDetails.sector), 'Enter a sector', false) }) + + it('should display a validation error message when the win date is in the future', () => { + const today = new Date() + // Indexing starts at zero (0 - 11) so we have to increment by 2 for next month + const month = today.getMonth() + 2 + const year = today.getFullYear() + cy.get(winDetails.dateMonth).type(month) + cy.get(winDetails.dateYear).type(year) + clickContinueButton() + assertFieldError( + cy.get(winDetails.date), + 'Date must be in the last 12 months', + true + ) + }) + + it('should display a validation error message when the win date is greater than twelve months ago', () => { + const today = new Date() + // Indexing starts at zero (0 - 11) so no need to decrement by 1 + const month = today.getMonth() + const year = today.getFullYear() - 1 + cy.get(winDetails.dateMonth).type(month) + cy.get(winDetails.dateYear).type(year) + clickContinueButton() + assertFieldError( + cy.get(winDetails.date), + 'Date must be in the last 12 months', + true + ) + }) }) context('Support provided', () => {