Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return version can be on/after licence start date #1224

Merged
merged 9 commits into from
Aug 2, 2024
4 changes: 2 additions & 2 deletions app/validators/return-requirements/start-date.validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ function _validateAnotherStartDate (payload, licenceStartDate, licenceEndDate) {
.date()
.format(['YYYY-MM-DD'])
.required()
.greater(licenceStartDate)
.min(licenceStartDate)
.less(licenceEndDate || '9999-12-31')
.messages({
'date.base': 'Enter a real start date',
'date.format': 'Enter a real start date',
'date.greater': 'Start date must be after the original licence start date',
'date.min': 'Start date must be on or after the original licence start date',
'date.less': 'Start date must be before the licence end date'
}),
otherwise: Joi.forbidden()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,11 @@ describe('Start Date validator', () => {
payload['start-date-year'] = '2022'
})

it('fails validation with the message "Start date must be after the original licence start date"', () => {
it('fails validation with the message "Start date must be on or after the original licence start date"', () => {
const result = StartDateValidator.go(payload, licenceStartDate, licenceEndDate)

expect(result.error).to.exist()
expect(result.error.details[0].message).to.equal('Start date must be after the original licence start date')
expect(result.error.details[0].message).to.equal('Start date must be on or after the original licence start date')
})
})

Expand Down
Loading