Skip to content

Commit

Permalink
Crs 2191 validate calculation dates (#855)
Browse files Browse the repository at this point in the history
* CRS-2191-validate-calculation-dates

Refactor manualEntryService.ts to use CRD validate dates endpoint.

Remove unused variables within the codebase.

* CRS-2191-validate-calculation-dates

Refactor manualEntryService.ts to use CRD validate dates endpoint.

Remove unused variables within the codebase.

* CRS-2191-validate-calculation-dates

Stub new CRD endpoint for use with wiremock.
Update test data to be valid inline with new validation.
  • Loading branch information
mg-moj authored Dec 11, 2024
1 parent 5ac74d0 commit 70bd7d5
Show file tree
Hide file tree
Showing 10 changed files with 344 additions and 222 deletions.
9 changes: 5 additions & 4 deletions integration_tests/e2e/manualDatesPath.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ context('End to end user journeys entering and modifying approved dates', () =>
cy.task('stubSaveManualEntry')
cy.task('stubGetCalculationResults')
cy.task('stubHasNoRecallSentences')
cy.task('stubManualEntryDateValidation')
})

it('Can add some manual dates', () => {
Expand Down Expand Up @@ -66,14 +67,14 @@ context('End to end user journeys entering and modifying approved dates', () =>
'NPD',
'DPRRD',
])
selectDatesPage.checkDate('SED')
selectDatesPage.checkDate('LED')
selectDatesPage.checkDate('CRD')
selectDatesPage.checkDate('MTD')
selectDatesPage.continue().click()

const enterSedPage = Page.verifyOnPage(ManualDatesEnterDatePage)
enterSedPage.checkIsFor('SED')
enterSedPage.enterDate('SED', '01', '06', '2026')
enterSedPage.checkIsFor('LED')
enterSedPage.enterDate('LED', '01', '06', '2026')
enterSedPage.continue().click()

const enterCRDPage = Page.verifyOnPage(ManualDatesEnterDatePage)
Expand All @@ -87,7 +88,7 @@ context('End to end user journeys entering and modifying approved dates', () =>
enterMTDPage.continue().click()

const manualDatesConfirmationPage = Page.verifyOnPage(ManualDatesConfirmationPage)
manualDatesConfirmationPage.dateShouldHaveValue('SED', '01 June 2026')
manualDatesConfirmationPage.dateShouldHaveValue('LED', '01 June 2026')
manualDatesConfirmationPage.dateShouldHaveValue('CRD', '03 September 2027')
manualDatesConfirmationPage.dateShouldHaveValue('MTD', '09 March 2028')
// check unselected dates are not shown
Expand Down
13 changes: 13 additions & 0 deletions integration_tests/mockApis/calculateReleaseDatesApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,19 @@ export default {
},
})
},
stubManualEntryDateValidation: (): SuperAgentRequest => {
return stubFor({
request: {
method: 'GET',
urlPattern: '/calculate-release-dates/validation/manual-entry-dates-validation\\?releaseDates=([A-Z|,]*)',
},
response: {
status: 200,
headers: { 'Content-Type': 'application/json;charset=UTF-8' },
jsonBody: [],
},
})
},
stubSupportedValidationNoMessages: (): SuperAgentRequest => {
return stubFor({
request: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,18 @@ import { components } from './index'
export type BookingCalculation = components['schemas']['CalculatedReleaseDates']
export type WorkingDay = components['schemas']['WorkingDay']
export type CalculationBreakdown = components['schemas']['CalculationBreakdown']
export type DateBreakdown = components['schemas']['DateBreakdown']
export type ValidationMessage = components['schemas']['ValidationMessage']
export type ReleaseDateCalculationBreakdown = components['schemas']['ReleaseDateCalculationBreakdown']
export type CalculationFragments = components['schemas']['CalculationFragments']
export type CalculationUserInputs = components['schemas']['CalculationUserInputs']
export type CalculationRequestModel = components['schemas']['CalculationRequestModel']
export type CalculationSentenceUserInput = components['schemas']['CalculationSentenceUserInput']
export type CalculationResults = components['schemas']['CalculationResults']
export type SubmittedDate = components['schemas']['SubmittedDate']
export type ManualEntrySelectedDate = components['schemas']['ManualEntrySelectedDate']
export type ManualEntryRequest = components['schemas']['ManualEntryRequest']
export type SubmitCalculationRequest = components['schemas']['SubmitCalculationRequest']
export type GenuineOverrideRequest = components['schemas']['GenuineOverrideRequest']
export type GenuineOverrideDateRequest = components['schemas']['GenuineOverrideDateRequest']
export type GenuineOverrideDateResponse = components['schemas']['GenuineOverrideDateResponse']
export type NonFridayReleaseDay = components['schemas']['NonFridayReleaseDay']
export type ComparisonInput = components['schemas']['ComparisonInput']
export type Comparison = components['schemas']['Comparison']
export type ComparisonSummary = components['schemas']['ComparisonSummary']
export type ComparisonOverview = components['schemas']['ComparisonOverview']
Expand All @@ -34,7 +29,6 @@ export type ComparisonPersonDiscrepancyCause = components['schemas']['Discrepanc
export type HistoricCalculation = components['schemas']['HistoricCalculation']
export type DetailedCalculationResults = components['schemas']['DetailedCalculationResults']
export type DetailedDate = components['schemas']['DetailedDate']
export type CalculationPrisonerDetails = components['schemas']['PrisonerDetails']
export type LatestCalculation = components['schemas']['LatestCalculation']
export type DateTypeDefinition = components['schemas']['DateTypeDefinition']
export type NomisCalculationSummary = components['schemas']['NomisCalculationSummary']
Expand Down
Loading

0 comments on commit 70bd7d5

Please sign in to comment.