-
Notifications
You must be signed in to change notification settings - Fork 2
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
feat: is_statutory_application_type
helper functions added to API on publish
#4200
Conversation
Removed vultr server and associated DNS entries |
fa04c0f
to
159b849
Compare
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.
Moved isComponentType
out of validate folder as I was using it in the Publish work so it seemed necessary to put it in a file which covers the module rather than just a service within it
6260060
to
792555d
Compare
is_staturory_application_type
helper functions added to API on publishis_statutory_application_type
helper functions added to API on publish
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.
Took a quick first pass - there's a few immediate things to tidy up here please!
I'll come back tomorrow morning with fresher eyes to fully review the functionality of the new function and testing on the pizza - I think it might be nice to check-in or pair about how to generate realistic mock flow data for testing, and how to simplify the logic here a bit ?
editor.planx.uk/src/pages/FlowEditor/components/Sidebar/Publish/PublishFlowButton.tsx
Outdated
Show resolved
Hide resolved
fixing formatting add helpers and refine current tests add fail path test refine test naming remove redudant flattenedFlow checks
173edfc
to
8e11ab6
Compare
remove appTypeCheckMocks shift order of service.ts in publish set user role for publish.test first publish test add formatting back to publish.test refine test return of schema values
6c3c801
to
30e3f50
Compare
|
||
test("returns true for a flow with Send and at least one statutory application.type in a SetValue Component", () => { | ||
expect( | ||
hasStatutoryApplicationType(mockSetValueStatutoryApplicationType), |
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.
Added this to ensure it goes into the first nested if()
condition, otherwise the test didn't have it covered
}, | ||
type: TYPES.SetValue, | ||
}, | ||
} as FlowGraph; |
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.
Required the cast to ensure type error didn't pop up on the next delete
line
const delta = jsondiffpatch.diff(mostRecent, flattenedFlow); | ||
|
||
if (!delta) return null; | ||
|
||
const hasSendComponent = hasComponentType(flattenedFlow, ComponentType.Send); | ||
const isStatutoryApplication = | ||
hasSendComponent && hasStatutoryApplicationType(flattenedFlow); |
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.
added this line so you don't need to go into the fn to understand it's initial condition or what defines a statutory application
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.
Thanks for changes - this all feels much simpler, more readable, and better tested than the first iteration ! Two small comments, happy for this to merge 👍
What does this PR do?
This PR introduces API functions to update
is_statutory_application_type
and unit testing within the API that monitors how it is assigned when a flow is published at theflow/:flowId/publish
end point.I have also rearranged parts of the code in the API to match the way I'm importing certain functions and mocks