-
Notifications
You must be signed in to change notification settings - Fork 0
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
DSFAAP-510: create task list page and add model for tasks #39
base: main
Are you sure you want to change the base?
Conversation
@joseluisgraa - I think there's something off with the structure here. The models (e.g. We want the user experience (in terms of validation, error messages, etc) to be consistent across those sections - which the A better layout would be (IMO):
and
Then the origin & licensed sections can make reference to the Address answer model. |
You are right, I created the one for the task and then started moving the existing ones into origin without realising they would be reused by different sections. I'll follow your proposed structure. |
src/server/task-list/controller.js
Outdated
* @param {boolean} isValid | ||
* @param {boolean} isEnabled | ||
*/ | ||
function buildGdsTaskItem(title, initialLink, summaryLink, isValid, isEnabled) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find a this bit hard to read because we've got positional booleans, at the call site it's not clear what they mean.
normally I go for a 'options object' pattern here, so:
function buildGdsTaskItem({ title, initialLink, summaryLink, isValid, isEnabled }) {...}
Then the callsite looks like:
const destinationGdsTask = buildGdsTaskItem({
title: 'Movement destination',
initialLink: '#',
summaryLink: '#',
isValid: destination.validate().isValid,
isEnabled: isOriginValid
})
let validationSchema | ||
|
||
beforeEach(() => { | ||
validationSchema = Joi.object({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
schemas don't get mutated by being validated (may even be immutable?), so you can do:
const validationSchema = Joi.object({
addressLine1: Joi.string().required(),
postcode: Joi.string().required()
})
and drop the beforeEach
block
No description provided.