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

fix: remove Invite to Pay proposal.projectType validation on publish #4064

Merged
merged 1 commit into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 0 additions & 15 deletions api.planx.uk/modules/flows/validate/service/inviteToPay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,21 +44,6 @@ const validateInviteToPay = (flowGraph: FlowGraph): FlowValidationResponse => {
};
}

if (
!hasComponentType(
flowGraph,
ComponentType.Checklist,
"proposal.projectType",
)
) {
return {
title: "Invite to Pay",
status: "Fail",
message:
"When using Invite to Pay, your flow must have a Checklist that sets `proposal.projectType`",
};
}

return {
title: "Invite to Pay",
status: "Pass",
Expand Down
59 changes: 0 additions & 59 deletions api.planx.uk/modules/flows/validate/validate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -447,65 +447,6 @@ describe("invite to pay validation on diff", () => {
]);
});
});

it("does not update if invite to pay is enabled, but there is not a Checklist that sets `proposal.projectType`", async () => {
const invalidatedFlow = flowWithInviteToPay;
// Remove proposal.projectType, set incorrect variable
invalidatedFlow!.Checklist!.data!.fn = "some.other.variable";

queryMock.mockQuery({
name: "GetFlowData",
matchOnVariables: false,
data: {
flow: {
data: invalidatedFlow,
slug: "invalidated-flow-name",
team_id: 1,
team: {
slug: "testing",
},
publishedFlows: [{ data: invalidatedFlow }],
},
},
});

await supertest(app)
.post("/flows/1/diff")
.set(auth)
.expect(200)
.then((res) => {
expect(res.body.message).toEqual("Changes queued to publish");
expect(res.body.validationChecks).toEqual([
{
title: "Invite to Pay",
status: "Fail",
message:
"When using Invite to Pay, your flow must have a Checklist that sets `proposal.projectType`",
},
{
title: "Sections",
status: "Not applicable",
message: "Your flow is not using Sections",
},
{
title: "File types",
status: "Not applicable",
message: "Your flow is not using FileUpload or UploadAndLabel",
},
{
title: "Project types",
status: "Not applicable",
message:
'Your flow is not using Checklists which set "proposal.projectType"',
},
{
title: "Planning Constraints",
status: "Not applicable",
message: "Your flow is not using Planning Constraints",
},
]);
});
});
});

describe("ODP Schema file type validation on diff", () => {
Expand Down
Loading