diff --git a/api.planx.uk/modules/flows/publish/publish.test.ts b/api.planx.uk/modules/flows/publish/publish.test.ts index 86f6cc1f23..3f1f5173c5 100644 --- a/api.planx.uk/modules/flows/publish/publish.test.ts +++ b/api.planx.uk/modules/flows/publish/publish.test.ts @@ -3,8 +3,8 @@ import supertest from "supertest"; import { queryMock } from "../../../tests/graphqlQueryMock"; import { authHeader, getJWT } from "../../../tests/mockJWT"; import app from "../../../server"; -import { FlowGraph } from "@opensystemslab/planx-core/types"; import { userContext } from "../../auth/middleware"; +import { mockFlowData } from "../../../tests/mocks/validateAndPublishMocks"; beforeAll(() => { const getStoreMock = jest.spyOn(userContext, "getStore"); @@ -154,113 +154,3 @@ describe("publish", () => { }); }); }); - -const mockFlowData: FlowGraph = { - _root: { - edges: [ - "SectionOne", - "QuestionOne", - "InternalPortalNode", - "FindPropertyNode", - "PayNode", - "SendNode", - "ResultNode", - "ConfirmationNode", - ], - }, - SectionOne: { - type: 360, - data: { - title: "Section 1", - }, - }, - FindPropertyNode: { - type: 9, - }, - ResultNode: { - data: { - flagSet: "Planning permission", - overrides: { - NO_APP_REQUIRED: { - heading: "Congratulations!", - }, - }, - }, - type: 3, - }, - AnswerOne: { - data: { - text: "?", - }, - type: 200, - }, - QuestionInPortal: { - data: { - text: "internal question", - }, - type: 100, - edges: ["AnswerInPortalOne", "AnswerInPortalTwo"], - }, - AnswerTwo: { - data: { - text: "!!", - }, - type: 200, - }, - InternalPortalNode: { - data: { - text: "portal", - }, - type: 300, - edges: ["QuestionInPortal"], - }, - QuestionOne: { - data: { - text: "Question", - }, - type: 100, - edges: ["AnswerOne", "AnswerTwo"], - }, - PayNode: { - data: { - fn: "application.fee.payable", - url: "http://localhost:7002/pay", - color: "#EFEFEF", - title: "Pay for your application", - description: - '

The planning fee covers the cost of processing your application. Find out more about how planning fees are calculated here.

', - }, - type: 400, - }, - AnswerInPortalOne: { - data: { - text: "?", - }, - type: 200, - }, - AnswerInPortalTwo: { - data: { - text: "*", - }, - type: 200, - }, - ConfirmationNode: { - data: { - heading: "Application sent", - moreInfo: - "

You will be contacted

\n\n", - contactInfo: - '

You can contact us at planning@lambeth.gov.uk

\n', - description: - "A payment receipt has been emailed to you. You will also receive an email to confirm when your application has been received.", - feedbackCTA: "What did you think of this service? (takes 30 seconds)", - }, - type: 725, - }, - SendNode: { - data: { - url: "http://localhost:7002/bops/southwark", - }, - type: 650, - }, -}; diff --git a/api.planx.uk/modules/flows/validate/validate.test.ts b/api.planx.uk/modules/flows/validate/validate.test.ts index a77fbe2741..41519f2925 100644 --- a/api.planx.uk/modules/flows/validate/validate.test.ts +++ b/api.planx.uk/modules/flows/validate/validate.test.ts @@ -4,8 +4,9 @@ import { queryMock } from "../../../tests/graphqlQueryMock"; import { authHeader, getJWT } from "../../../tests/mockJWT"; import app from "../../../server"; import { flowWithInviteToPay } from "../../../tests/mocks/inviteToPayData"; -import { FlowGraph } from "@opensystemslab/planx-core/types"; import { userContext } from "../../auth/middleware"; +import { FlowGraph } from "@opensystemslab/planx-core/types"; +import { mockFlowData } from "../../../tests/mocks/validateAndPublishMocks"; beforeAll(() => { const getStoreMock = jest.spyOn(userContext, "getStore"); @@ -294,113 +295,3 @@ describe("invite to pay validation on diff", () => { }); }); }); - -const mockFlowData: FlowGraph = { - _root: { - edges: [ - "SectionOne", - "QuestionOne", - "InternalPortalNode", - "FindPropertyNode", - "PayNode", - "SendNode", - "ResultNode", - "ConfirmationNode", - ], - }, - SectionOne: { - type: 360, - data: { - title: "Section 1", - }, - }, - FindPropertyNode: { - type: 9, - }, - ResultNode: { - data: { - flagSet: "Planning permission", - overrides: { - NO_APP_REQUIRED: { - heading: "Congratulations!", - }, - }, - }, - type: 3, - }, - AnswerOne: { - data: { - text: "?", - }, - type: 200, - }, - QuestionInPortal: { - data: { - text: "internal question", - }, - type: 100, - edges: ["AnswerInPortalOne", "AnswerInPortalTwo"], - }, - AnswerTwo: { - data: { - text: "!!", - }, - type: 200, - }, - InternalPortalNode: { - data: { - text: "portal", - }, - type: 300, - edges: ["QuestionInPortal"], - }, - QuestionOne: { - data: { - text: "Question", - }, - type: 100, - edges: ["AnswerOne", "AnswerTwo"], - }, - PayNode: { - data: { - fn: "application.fee.payable", - url: "http://localhost:7002/pay", - color: "#EFEFEF", - title: "Pay for your application", - description: - '

The planning fee covers the cost of processing your application. Find out more about how planning fees are calculated here.

', - }, - type: 400, - }, - AnswerInPortalOne: { - data: { - text: "?", - }, - type: 200, - }, - AnswerInPortalTwo: { - data: { - text: "*", - }, - type: 200, - }, - ConfirmationNode: { - data: { - heading: "Application sent", - moreInfo: - "

You will be contacted

\n\n", - contactInfo: - '

You can contact us at planning@lambeth.gov.uk

\n', - description: - "A payment receipt has been emailed to you. You will also receive an email to confirm when your application has been received.", - feedbackCTA: "What did you think of this service? (takes 30 seconds)", - }, - type: 725, - }, - SendNode: { - data: { - url: "http://localhost:7002/bops/southwark", - }, - type: 650, - }, -}; diff --git a/api.planx.uk/server.ts b/api.planx.uk/server.ts index a3af635bf9..cf50850b0c 100644 --- a/api.planx.uk/server.ts +++ b/api.planx.uk/server.ts @@ -32,7 +32,6 @@ import { useFilePermission, useHasuraAuth, useSendEmailAuth, - usePlatformAdminAuth, } from "./modules/auth/middleware"; import airbrake from "./airbrake"; @@ -48,7 +47,6 @@ import { createSendEvents } from "./send/createSendEvents"; import { downloadApplicationFiles, sendToEmail } from "./send/email"; import { sendToUniform } from "./send/uniform"; import { useOrdnanceSurveyProxy } from "./proxy/ordnanceSurvey"; -import { gql } from "graphql-request"; import { classifiedRoadsSearch } from "./gis/classifiedRoads"; import { googleStrategy } from "./modules/auth/strategy/google"; import authRoutes from "./modules/auth/routes"; @@ -61,7 +59,6 @@ import adminRoutes from "./modules/admin/routes"; import flowRoutes from "./modules/flows/routes"; import { useSwaggerDocs } from "./docs"; import { Role } from "@opensystemslab/planx-core/types"; -import { $public } from "./client"; const router = express.Router(); diff --git a/api.planx.uk/tests/mocks/validateAndPublishMocks.ts b/api.planx.uk/tests/mocks/validateAndPublishMocks.ts new file mode 100644 index 0000000000..c137f6095d --- /dev/null +++ b/api.planx.uk/tests/mocks/validateAndPublishMocks.ts @@ -0,0 +1,111 @@ +import { FlowGraph } from "@opensystemslab/planx-core/types"; + +export const mockFlowData: FlowGraph = { + _root: { + edges: [ + "SectionOne", + "QuestionOne", + "InternalPortalNode", + "FindPropertyNode", + "PayNode", + "SendNode", + "ResultNode", + "ConfirmationNode", + ], + }, + SectionOne: { + type: 360, + data: { + title: "Section 1", + }, + }, + FindPropertyNode: { + type: 9, + }, + ResultNode: { + data: { + flagSet: "Planning permission", + overrides: { + NO_APP_REQUIRED: { + heading: "Congratulations!", + }, + }, + }, + type: 3, + }, + AnswerOne: { + data: { + text: "?", + }, + type: 200, + }, + QuestionInPortal: { + data: { + text: "internal question", + }, + type: 100, + edges: ["AnswerInPortalOne", "AnswerInPortalTwo"], + }, + AnswerTwo: { + data: { + text: "!!", + }, + type: 200, + }, + InternalPortalNode: { + data: { + text: "portal", + }, + type: 300, + edges: ["QuestionInPortal"], + }, + QuestionOne: { + data: { + text: "Question", + }, + type: 100, + edges: ["AnswerOne", "AnswerTwo"], + }, + PayNode: { + data: { + fn: "application.fee.payable", + url: "http://localhost:7002/pay", + color: "#EFEFEF", + title: "Pay for your application", + description: + '

The planning fee covers the cost of processing your application. Find out more about how planning fees are calculated here.

', + }, + type: 400, + }, + AnswerInPortalOne: { + data: { + text: "?", + }, + type: 200, + }, + AnswerInPortalTwo: { + data: { + text: "*", + }, + type: 200, + }, + ConfirmationNode: { + data: { + heading: "Application sent", + moreInfo: + "

You will be contacted

\n\n", + contactInfo: + '

You can contact us at planning@lambeth.gov.uk

\n', + description: + "A payment receipt has been emailed to you. You will also receive an email to confirm when your application has been received.", + feedbackCTA: "What did you think of this service? (takes 30 seconds)", + }, + type: 725, + }, + SendNode: { + data: { + url: "http://localhost:7002/bops/southwark", + }, + type: 650, + }, +};