From 5cf941f536fe3676109230938525cda319d17c55 Mon Sep 17 00:00:00 2001 From: Jessica McInchak Date: Fri, 24 Jan 2025 16:02:54 +0100 Subject: [PATCH 1/6] wip --- api.planx.uk/modules/send/utils/helpers.test.ts | 6 ++++++ api.planx.uk/modules/send/utils/helpers.ts | 14 +++++++------- api.planx.uk/package.json | 2 +- api.planx.uk/pnpm-lock.yaml | 10 +++++----- e2e/tests/api-driven/package.json | 2 +- e2e/tests/api-driven/pnpm-lock.yaml | 12 ++++++------ e2e/tests/ui-driven/package.json | 2 +- e2e/tests/ui-driven/pnpm-lock.yaml | 10 +++++----- editor.planx.uk/package.json | 2 +- editor.planx.uk/pnpm-lock.yaml | 10 +++++----- 10 files changed, 38 insertions(+), 32 deletions(-) create mode 100644 api.planx.uk/modules/send/utils/helpers.test.ts diff --git a/api.planx.uk/modules/send/utils/helpers.test.ts b/api.planx.uk/modules/send/utils/helpers.test.ts new file mode 100644 index 0000000000..c0b25b84f4 --- /dev/null +++ b/api.planx.uk/modules/send/utils/helpers.test.ts @@ -0,0 +1,6 @@ +describe("isApplicationTypeSupported", () => { + test.todo("returns true for statutory application types"); + test.todo("return true for pre-applications"); + test.todo("returns false for discretionary types"); + test.todo("returns false if passport does not have application.type key"); +}); \ No newline at end of file diff --git a/api.planx.uk/modules/send/utils/helpers.ts b/api.planx.uk/modules/send/utils/helpers.ts index 1ed97083f5..6ba76f9d14 100644 --- a/api.planx.uk/modules/send/utils/helpers.ts +++ b/api.planx.uk/modules/send/utils/helpers.ts @@ -1,3 +1,4 @@ +import { getValidSchemaValues } from "@opensystemslab/planx-core"; import type { Passport } from "../../../types.js"; /** @@ -6,12 +7,11 @@ import type { Passport } from "../../../types.js"; * @returns boolean */ export function isApplicationTypeSupported(passport: Passport): boolean { - // Prefixes of application types that are supported by the ODP Schema - // TODO in future look up via schema type definitions - const supportedAppTypes = ["ldc", "listed", "pa", "pp"]; + const userApplicationType = passport.data?.["application.type"]?.[0]; - const appType = passport.data?.["application.type"]?.[0]; - const appTypePrefix = appType?.split(".")?.[0]; - - return supportedAppTypes.includes(appTypePrefix); + const statutoryApplicationTypes = getValidSchemaValues('ApplicationType'); + const preApplicationType = "preApp"; + const supportedApplicationTypes = (statutoryApplicationTypes || []).concat(preApplicationType); + + return supportedApplicationTypes.includes(userApplicationType); } diff --git a/api.planx.uk/package.json b/api.planx.uk/package.json index b66a635ca5..5c24e71a40 100644 --- a/api.planx.uk/package.json +++ b/api.planx.uk/package.json @@ -13,7 +13,7 @@ "@airbrake/node": "^2.1.8", "@aws-sdk/client-s3": "^3.696.0", "@aws-sdk/s3-request-presigner": "^3.701.0", - "@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#01d3dc6", + "@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#6f16516", "@types/isomorphic-fetch": "^0.0.36", "adm-zip": "^0.5.10", "axios": "^1.7.4", diff --git a/api.planx.uk/pnpm-lock.yaml b/api.planx.uk/pnpm-lock.yaml index 528b190ed6..1c1bb171e0 100644 --- a/api.planx.uk/pnpm-lock.yaml +++ b/api.planx.uk/pnpm-lock.yaml @@ -21,8 +21,8 @@ dependencies: specifier: ^3.701.0 version: 3.701.0 '@opensystemslab/planx-core': - specifier: git+https://github.com/theopensystemslab/planx-core#01d3dc6 - version: github.com/theopensystemslab/planx-core/01d3dc6(@types/react@19.0.7) + specifier: git+https://github.com/theopensystemslab/planx-core#6f16516 + version: github.com/theopensystemslab/planx-core/6f16516(@types/react@19.0.7) '@types/isomorphic-fetch': specifier: ^0.0.36 version: 0.0.36 @@ -7755,9 +7755,9 @@ packages: resolution: {integrity: sha512-muH7gBL9sI1nciMZV67X5fTKKBLtwpZ5VBp1vsOQzj1MhrBZ4wlVCm3gedKZWLp0Oyel8sIGfeiz54Su+OVT+A==} dev: false - github.com/theopensystemslab/planx-core/01d3dc6(@types/react@19.0.7): - resolution: {tarball: https://codeload.github.com/theopensystemslab/planx-core/tar.gz/01d3dc6} - id: github.com/theopensystemslab/planx-core/01d3dc6 + github.com/theopensystemslab/planx-core/6f16516(@types/react@19.0.7): + resolution: {tarball: https://codeload.github.com/theopensystemslab/planx-core/tar.gz/6f16516} + id: github.com/theopensystemslab/planx-core/6f16516 name: '@opensystemslab/planx-core' version: 1.0.0 prepare: true diff --git a/e2e/tests/api-driven/package.json b/e2e/tests/api-driven/package.json index 0a4be8d203..d8b419917f 100644 --- a/e2e/tests/api-driven/package.json +++ b/e2e/tests/api-driven/package.json @@ -8,7 +8,7 @@ "packageManager": "pnpm@8.6.6", "dependencies": { "@cucumber/cucumber": "^11.1.1", - "@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#01d3dc6", + "@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#6f16516", "axios": "^1.7.4", "dotenv": "^16.3.1", "dotenv-expand": "^10.0.0", diff --git a/e2e/tests/api-driven/pnpm-lock.yaml b/e2e/tests/api-driven/pnpm-lock.yaml index 9ec2c3ac0c..5488205813 100644 --- a/e2e/tests/api-driven/pnpm-lock.yaml +++ b/e2e/tests/api-driven/pnpm-lock.yaml @@ -9,8 +9,8 @@ dependencies: specifier: ^11.1.1 version: 11.1.1 '@opensystemslab/planx-core': - specifier: git+https://github.com/theopensystemslab/planx-core#01d3dc6 - version: github.com/theopensystemslab/planx-core/01d3dc6(@types/react@19.0.7) + specifier: git+https://github.com/theopensystemslab/planx-core#6f16516 + version: github.com/theopensystemslab/planx-core/6f16516(@types/react@19.0.7) axios: specifier: ^1.7.4 version: 1.7.4 @@ -1149,7 +1149,7 @@ packages: dev: false /concat-map@0.0.1: - resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} + resolution: {integrity: sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=} dev: false /convert-source-map@1.9.0: @@ -3060,9 +3060,9 @@ packages: resolution: {integrity: sha512-muH7gBL9sI1nciMZV67X5fTKKBLtwpZ5VBp1vsOQzj1MhrBZ4wlVCm3gedKZWLp0Oyel8sIGfeiz54Su+OVT+A==} dev: false - github.com/theopensystemslab/planx-core/01d3dc6(@types/react@19.0.7): - resolution: {tarball: https://codeload.github.com/theopensystemslab/planx-core/tar.gz/01d3dc6} - id: github.com/theopensystemslab/planx-core/01d3dc6 + github.com/theopensystemslab/planx-core/6f16516(@types/react@19.0.7): + resolution: {tarball: https://codeload.github.com/theopensystemslab/planx-core/tar.gz/6f16516} + id: github.com/theopensystemslab/planx-core/6f16516 name: '@opensystemslab/planx-core' version: 1.0.0 prepare: true diff --git a/e2e/tests/ui-driven/package.json b/e2e/tests/ui-driven/package.json index 070c486e55..36ffbb49c6 100644 --- a/e2e/tests/ui-driven/package.json +++ b/e2e/tests/ui-driven/package.json @@ -9,7 +9,7 @@ }, "type": "module", "dependencies": { - "@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#01d3dc6", + "@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#6f16516", "axios": "^1.7.4", "dotenv": "^16.3.1", "eslint": "^8.56.0", diff --git a/e2e/tests/ui-driven/pnpm-lock.yaml b/e2e/tests/ui-driven/pnpm-lock.yaml index 3f9b02acab..44351b6e64 100644 --- a/e2e/tests/ui-driven/pnpm-lock.yaml +++ b/e2e/tests/ui-driven/pnpm-lock.yaml @@ -6,8 +6,8 @@ settings: dependencies: '@opensystemslab/planx-core': - specifier: git+https://github.com/theopensystemslab/planx-core#01d3dc6 - version: github.com/theopensystemslab/planx-core/01d3dc6(@types/react@19.0.7) + specifier: git+https://github.com/theopensystemslab/planx-core#6f16516 + version: github.com/theopensystemslab/planx-core/6f16516(@types/react@19.0.7) axios: specifier: ^1.7.4 version: 1.7.4 @@ -2614,9 +2614,9 @@ packages: resolution: {integrity: sha512-muH7gBL9sI1nciMZV67X5fTKKBLtwpZ5VBp1vsOQzj1MhrBZ4wlVCm3gedKZWLp0Oyel8sIGfeiz54Su+OVT+A==} dev: false - github.com/theopensystemslab/planx-core/01d3dc6(@types/react@19.0.7): - resolution: {tarball: https://codeload.github.com/theopensystemslab/planx-core/tar.gz/01d3dc6} - id: github.com/theopensystemslab/planx-core/01d3dc6 + github.com/theopensystemslab/planx-core/6f16516(@types/react@19.0.7): + resolution: {tarball: https://codeload.github.com/theopensystemslab/planx-core/tar.gz/6f16516} + id: github.com/theopensystemslab/planx-core/6f16516 name: '@opensystemslab/planx-core' version: 1.0.0 prepare: true diff --git a/editor.planx.uk/package.json b/editor.planx.uk/package.json index 18e8dd8790..7ea0046fdb 100644 --- a/editor.planx.uk/package.json +++ b/editor.planx.uk/package.json @@ -15,7 +15,7 @@ "@mui/material": "^5.15.10", "@mui/utils": "^5.15.11", "@opensystemslab/map": "1.0.0-alpha.4", - "@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#01d3dc6", + "@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#6f16516", "@tiptap/core": "^2.4.0", "@tiptap/extension-bold": "^2.0.3", "@tiptap/extension-bubble-menu": "^2.1.13", diff --git a/editor.planx.uk/pnpm-lock.yaml b/editor.planx.uk/pnpm-lock.yaml index a5fd2ff180..a9cd9dd1a8 100644 --- a/editor.planx.uk/pnpm-lock.yaml +++ b/editor.planx.uk/pnpm-lock.yaml @@ -48,8 +48,8 @@ dependencies: specifier: 1.0.0-alpha.4 version: 1.0.0-alpha.4 '@opensystemslab/planx-core': - specifier: git+https://github.com/theopensystemslab/planx-core#01d3dc6 - version: github.com/theopensystemslab/planx-core/01d3dc6(@types/react@18.2.45) + specifier: git+https://github.com/theopensystemslab/planx-core#6f16516 + version: github.com/theopensystemslab/planx-core/6f16516(@types/react@18.2.45) '@tiptap/core': specifier: ^2.4.0 version: 2.4.0(@tiptap/pm@2.0.3) @@ -14690,9 +14690,9 @@ packages: use-sync-external-store: 1.2.0(react@18.2.0) dev: false - github.com/theopensystemslab/planx-core/01d3dc6(@types/react@18.2.45): - resolution: {tarball: https://codeload.github.com/theopensystemslab/planx-core/tar.gz/01d3dc6} - id: github.com/theopensystemslab/planx-core/01d3dc6 + github.com/theopensystemslab/planx-core/6f16516(@types/react@18.2.45): + resolution: {tarball: https://codeload.github.com/theopensystemslab/planx-core/tar.gz/6f16516} + id: github.com/theopensystemslab/planx-core/6f16516 name: '@opensystemslab/planx-core' version: 1.0.0 prepare: true From 106e1ac3d1f9b3037cf093b5589afbc05c91ceb8 Mon Sep 17 00:00:00 2001 From: Jessica McInchak Date: Mon, 27 Jan 2025 17:20:52 +0100 Subject: [PATCH 2/6] prettier and api tests --- .../modules/send/utils/helpers.test.ts | 31 ++++++++++++++++--- api.planx.uk/modules/send/utils/helpers.ts | 8 +++-- 2 files changed, 31 insertions(+), 8 deletions(-) diff --git a/api.planx.uk/modules/send/utils/helpers.test.ts b/api.planx.uk/modules/send/utils/helpers.test.ts index c0b25b84f4..7dd2e8a448 100644 --- a/api.planx.uk/modules/send/utils/helpers.test.ts +++ b/api.planx.uk/modules/send/utils/helpers.test.ts @@ -1,6 +1,27 @@ +import type { Passport } from "@opensystemslab/planx-core/types"; + +import { isApplicationTypeSupported } from "./helpers.js"; + describe("isApplicationTypeSupported", () => { - test.todo("returns true for statutory application types"); - test.todo("return true for pre-applications"); - test.todo("returns false for discretionary types"); - test.todo("returns false if passport does not have application.type key"); -}); \ No newline at end of file + test("returns true for statutory application types", () => { + const mockPassport: Passport = { data: { "application.type": ["ldc.p"] } }; + expect(isApplicationTypeSupported(mockPassport)).toEqual(true); + }); + + test("return true for pre-applications", () => { + const mockPassport: Passport = { data: { "application.type": ["preApp"] } }; + expect(isApplicationTypeSupported(mockPassport)).toEqual(true); + }); + + test("returns false for discretionary types", () => { + const mockPassport: Passport = { data: { "application.type": ["breach"] } }; + expect(isApplicationTypeSupported(mockPassport)).toEqual(false); + }); + + test("returns false if passport does not have application.type key", () => { + const mockPassport: Passport = { + data: { "property.type": ["residential"] }, + }; + expect(isApplicationTypeSupported(mockPassport)).toEqual(false); + }); +}); diff --git a/api.planx.uk/modules/send/utils/helpers.ts b/api.planx.uk/modules/send/utils/helpers.ts index 6ba76f9d14..b65576f232 100644 --- a/api.planx.uk/modules/send/utils/helpers.ts +++ b/api.planx.uk/modules/send/utils/helpers.ts @@ -9,9 +9,11 @@ import type { Passport } from "../../../types.js"; export function isApplicationTypeSupported(passport: Passport): boolean { const userApplicationType = passport.data?.["application.type"]?.[0]; - const statutoryApplicationTypes = getValidSchemaValues('ApplicationType'); + const statutoryApplicationTypes = getValidSchemaValues("ApplicationType"); const preApplicationType = "preApp"; - const supportedApplicationTypes = (statutoryApplicationTypes || []).concat(preApplicationType); - + const supportedApplicationTypes = (statutoryApplicationTypes || []).concat( + preApplicationType, + ); + return supportedApplicationTypes.includes(userApplicationType); } From 6397ae05ee5d7043d21653067259ac58f8af656d Mon Sep 17 00:00:00 2001 From: Jessica McInchak Date: Tue, 28 Jan 2025 10:17:42 +0100 Subject: [PATCH 3/6] add missing test coverage for validation helpers --- .../modules/flows/validate/helpers.test.ts | 149 ++++++++++++++++++ .../modules/flows/validate/helpers.ts | 27 ++-- 2 files changed, 167 insertions(+), 9 deletions(-) create mode 100644 api.planx.uk/modules/flows/validate/helpers.test.ts diff --git a/api.planx.uk/modules/flows/validate/helpers.test.ts b/api.planx.uk/modules/flows/validate/helpers.test.ts new file mode 100644 index 0000000000..1bce61589b --- /dev/null +++ b/api.planx.uk/modules/flows/validate/helpers.test.ts @@ -0,0 +1,149 @@ +import type { FlowGraph } from "@opensystemslab/planx-core/types"; +import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; + +import { hasComponentType, numberOfComponentType } from "./helpers.js"; + +describe("hasComponentType", () => { + test("it returns true for a component type that is present", () => { + expect(hasComponentType(flow, TYPES.Question)).toEqual(true); + }); + + test("it returns false for a component type that is not present", () => { + expect(hasComponentType(flow, TYPES.DrawBoundary)).toEqual(false); + }); + + test("it returns true for a component type that is present and has the specified data field as a `val` prop", () => { + expect(hasComponentType(flow, TYPES.Answer, "residential.flat")).toEqual( + true, + ); + }); + + test("it returns true for a component type that is present and has the specified data field as a `fn` prop", () => { + expect(hasComponentType(flow, TYPES.Question, "property.type")).toEqual( + true, + ); + }); + + test("it returns false for a component type that is present but does not have the specified data field", () => { + expect(hasComponentType(flow, TYPES.Question, "application.type")).toEqual( + false, + ); + }); +}); + +describe("numberOfComponentType", () => { + test("it returns the correct count of nested component types", () => { + expect(numberOfComponentType(flow, TYPES.Answer)).toEqual(5); + }); + + test("it returns the correct count of component types with a specified data field as a `fn` prop", () => { + expect( + numberOfComponentType(flow, TYPES.Question, "property.type"), + ).toEqual(2); + }); + + test("it returns the correct count of component types with a specified data field as a `val` prop", () => { + expect(numberOfComponentType(flow, TYPES.Answer, "residential")).toEqual(1); + }); + + test("it returns 0 for a component type that is not present", () => { + expect(numberOfComponentType(flow, TYPES.Calculate)).toEqual(0); + }); + + test("it returns 0 for a component type that is present but does not have the specified data field", () => { + expect( + numberOfComponentType(flow, TYPES.Question, "application.type"), + ).toEqual(0); + }); +}); + +const flow: FlowGraph = { + _root: { + edges: ["FindProperty", "QuestionOne", "Result", "Notice"], + }, + "4jSYMB7hBJ": { + data: { + val: "residential.house", + text: "House", + flags: ["flag.pp.permittedDevelopment"], + }, + type: TYPES.Answer, + }, + FindProperty: { + data: { + title: "Find the property", + newAddressTitle: + "Click or tap at where the property is on the map and name it below", + allowNewAddresses: false, + newAddressDescription: + "You will need to select a location and provide a name to continue", + newAddressDescriptionLabel: "Name the site", + }, + type: TYPES.FindProperty, + }, + Notice: { + data: { + color: "#EFEFEF", + title: "End of test", + resetButton: true, + }, + type: TYPES.Notice, + }, + QJeTHUDzfz: { + data: { + text: "Something else", + flags: ["flag.pp.missingInfo"], + }, + type: TYPES.Answer, + }, + QuestionTwo: { + data: { + fn: "property.type", + tags: [], + text: "What type of residence is it?", + neverAutoAnswer: false, + }, + type: TYPES.Question, + edges: ["4jSYMB7hBJ", "xHpGvCpm0y", "QJeTHUDzfz"], + }, + oaF6TgEGZO: { + data: { + val: "residential", + text: "Residential", + flags: ["flag.pp.permittedDevelopment"], + }, + type: TYPES.Answer, + edges: ["QuestionTwo"], + }, + QuestionOne: { + data: { + fn: "property.type", + tags: [], + text: "What type of property is it?", + neverAutoAnswer: false, + }, + type: TYPES.Question, + edges: ["oaF6TgEGZO", "tgP6NiYImY"], + }, + tgP6NiYImY: { + data: { + text: "Something else", + flags: ["flag.pp.missingInfo"], + }, + type: TYPES.Answer, + }, + xHpGvCpm0y: { + data: { + val: "residential.flat", + text: "Flat", + flags: ["flag.pp.permissionNeeded"], + }, + type: TYPES.Answer, + }, + Result: { + data: { + flagSet: "Planning permission", + }, + type: TYPES.Result, + }, +}; diff --git a/api.planx.uk/modules/flows/validate/helpers.ts b/api.planx.uk/modules/flows/validate/helpers.ts index cbc4c3770e..3de70f98b7 100644 --- a/api.planx.uk/modules/flows/validate/helpers.ts +++ b/api.planx.uk/modules/flows/validate/helpers.ts @@ -1,7 +1,7 @@ -import type { +import { ComponentType, - FlowGraph, - Node, + type FlowGraph, + type Node, } from "@opensystemslab/planx-core/types"; import type { Entry } from "type-fest"; @@ -24,7 +24,11 @@ export const hasComponentType = ( ); if (fn) { - return nodeIds.some(([, nodeData]) => nodeData?.data?.fn === fn); + if (type === ComponentType.Answer) { + return nodeIds.some(([, nodeData]) => nodeData?.data?.val === fn); + } else { + return nodeIds.some(([, nodeData]) => nodeData?.data?.fn === fn); + } } return Boolean(nodeIds.length); @@ -39,11 +43,16 @@ export const numberOfComponentType = ( (entry): entry is [string, Node] => isComponentType(entry, type), ); if (fn) { - nodeIds - ?.filter(([_nodeId, nodeData]) => nodeData?.data?.fn === fn) - ?.map(([nodeId, _nodeData]) => nodeId); + if (type === ComponentType.Answer) { + return nodeIds + ?.filter(([_nodeId, nodeData]) => nodeData?.data?.val === fn) + ?.map(([nodeId, _nodeData]) => nodeId)?.length; + } else { + return nodeIds + ?.filter(([_nodeId, nodeData]) => nodeData?.data?.fn === fn) + ?.map(([nodeId, _nodeData]) => nodeId)?.length; + } } else { - nodeIds?.map(([nodeId, _nodeData]) => nodeId); + return nodeIds?.map(([nodeId, _nodeData]) => nodeId)?.length; } - return nodeIds?.length; }; From f1096bd2fd4a7e9c5e4e2943e713fd61588b4fea Mon Sep 17 00:00:00 2001 From: Jessica McInchak Date: Tue, 28 Jan 2025 10:35:16 +0100 Subject: [PATCH 4/6] mockImplementation of getValidSchemaValues --- api.planx.uk/modules/send/utils/exportZip.test.ts | 3 +++ api.planx.uk/modules/send/utils/helpers.test.ts | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/api.planx.uk/modules/send/utils/exportZip.test.ts b/api.planx.uk/modules/send/utils/exportZip.test.ts index 8a7e0f2daf..c266347191 100644 --- a/api.planx.uk/modules/send/utils/exportZip.test.ts +++ b/api.planx.uk/modules/send/utils/exportZip.test.ts @@ -51,6 +51,9 @@ vi.mock("@opensystemslab/planx-core", () => { .fn() .mockImplementation(() => "

application

"), generateMapHTML: vi.fn().mockImplementation(() => "

map

"), + getValidSchemaValues: vi + .fn() + .mockImplementation(() => ["ldc", "ldc.p", "ldc.e", "pp", "pa"]), }; }); const mockGenerateOneAppXML = vi diff --git a/api.planx.uk/modules/send/utils/helpers.test.ts b/api.planx.uk/modules/send/utils/helpers.test.ts index 7dd2e8a448..c56cda885e 100644 --- a/api.planx.uk/modules/send/utils/helpers.test.ts +++ b/api.planx.uk/modules/send/utils/helpers.test.ts @@ -2,7 +2,19 @@ import type { Passport } from "@opensystemslab/planx-core/types"; import { isApplicationTypeSupported } from "./helpers.js"; +vi.mock("@opensystemslab/planx-core", () => { + return { + getValidSchemaValues: vi + .fn() + .mockImplementation(() => ["ldc", "ldc.p", "ldc.e", "pp", "pa"]), + }; +}); + describe("isApplicationTypeSupported", () => { + beforeEach(() => { + vi.clearAllMocks(); + }); + test("returns true for statutory application types", () => { const mockPassport: Passport = { data: { "application.type": ["ldc.p"] } }; expect(isApplicationTypeSupported(mockPassport)).toEqual(true); From 9bc22e2266b42eccb0fe129c88236de24c704547 Mon Sep 17 00:00:00 2001 From: Jessica McInchak Date: Tue, 28 Jan 2025 18:35:06 +0100 Subject: [PATCH 5/6] early return if no passport value --- api.planx.uk/modules/send/utils/helpers.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/api.planx.uk/modules/send/utils/helpers.ts b/api.planx.uk/modules/send/utils/helpers.ts index b65576f232..ccdb80446a 100644 --- a/api.planx.uk/modules/send/utils/helpers.ts +++ b/api.planx.uk/modules/send/utils/helpers.ts @@ -8,6 +8,7 @@ import type { Passport } from "../../../types.js"; */ export function isApplicationTypeSupported(passport: Passport): boolean { const userApplicationType = passport.data?.["application.type"]?.[0]; + if (!userApplicationType) return false; const statutoryApplicationTypes = getValidSchemaValues("ApplicationType"); const preApplicationType = "preApp"; From be3f0262d379fc337a9cd549ef010475c19aa6fc Mon Sep 17 00:00:00 2001 From: Jessica McInchak Date: Wed, 29 Jan 2025 10:33:31 +0100 Subject: [PATCH 6/6] planx-core main commit hash --- api.planx.uk/package.json | 2 +- api.planx.uk/pnpm-lock.yaml | 10 +++++----- e2e/tests/api-driven/package.json | 2 +- e2e/tests/api-driven/pnpm-lock.yaml | 10 +++++----- e2e/tests/ui-driven/package.json | 2 +- e2e/tests/ui-driven/pnpm-lock.yaml | 10 +++++----- editor.planx.uk/package.json | 2 +- editor.planx.uk/pnpm-lock.yaml | 17 +++++++++++------ 8 files changed, 30 insertions(+), 25 deletions(-) diff --git a/api.planx.uk/package.json b/api.planx.uk/package.json index 5c24e71a40..1b415ee4f5 100644 --- a/api.planx.uk/package.json +++ b/api.planx.uk/package.json @@ -13,7 +13,7 @@ "@airbrake/node": "^2.1.8", "@aws-sdk/client-s3": "^3.696.0", "@aws-sdk/s3-request-presigner": "^3.701.0", - "@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#6f16516", + "@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#03de3e0", "@types/isomorphic-fetch": "^0.0.36", "adm-zip": "^0.5.10", "axios": "^1.7.4", diff --git a/api.planx.uk/pnpm-lock.yaml b/api.planx.uk/pnpm-lock.yaml index 1c1bb171e0..25443277db 100644 --- a/api.planx.uk/pnpm-lock.yaml +++ b/api.planx.uk/pnpm-lock.yaml @@ -21,8 +21,8 @@ dependencies: specifier: ^3.701.0 version: 3.701.0 '@opensystemslab/planx-core': - specifier: git+https://github.com/theopensystemslab/planx-core#6f16516 - version: github.com/theopensystemslab/planx-core/6f16516(@types/react@19.0.7) + specifier: git+https://github.com/theopensystemslab/planx-core#03de3e0 + version: github.com/theopensystemslab/planx-core/03de3e0(@types/react@19.0.7) '@types/isomorphic-fetch': specifier: ^0.0.36 version: 0.0.36 @@ -7755,9 +7755,9 @@ packages: resolution: {integrity: sha512-muH7gBL9sI1nciMZV67X5fTKKBLtwpZ5VBp1vsOQzj1MhrBZ4wlVCm3gedKZWLp0Oyel8sIGfeiz54Su+OVT+A==} dev: false - github.com/theopensystemslab/planx-core/6f16516(@types/react@19.0.7): - resolution: {tarball: https://codeload.github.com/theopensystemslab/planx-core/tar.gz/6f16516} - id: github.com/theopensystemslab/planx-core/6f16516 + github.com/theopensystemslab/planx-core/03de3e0(@types/react@19.0.7): + resolution: {tarball: https://codeload.github.com/theopensystemslab/planx-core/tar.gz/03de3e0} + id: github.com/theopensystemslab/planx-core/03de3e0 name: '@opensystemslab/planx-core' version: 1.0.0 prepare: true diff --git a/e2e/tests/api-driven/package.json b/e2e/tests/api-driven/package.json index d8b419917f..90cf80b744 100644 --- a/e2e/tests/api-driven/package.json +++ b/e2e/tests/api-driven/package.json @@ -8,7 +8,7 @@ "packageManager": "pnpm@8.6.6", "dependencies": { "@cucumber/cucumber": "^11.1.1", - "@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#6f16516", + "@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#03de3e0", "axios": "^1.7.4", "dotenv": "^16.3.1", "dotenv-expand": "^10.0.0", diff --git a/e2e/tests/api-driven/pnpm-lock.yaml b/e2e/tests/api-driven/pnpm-lock.yaml index 5488205813..e0e00c31f7 100644 --- a/e2e/tests/api-driven/pnpm-lock.yaml +++ b/e2e/tests/api-driven/pnpm-lock.yaml @@ -9,8 +9,8 @@ dependencies: specifier: ^11.1.1 version: 11.1.1 '@opensystemslab/planx-core': - specifier: git+https://github.com/theopensystemslab/planx-core#6f16516 - version: github.com/theopensystemslab/planx-core/6f16516(@types/react@19.0.7) + specifier: git+https://github.com/theopensystemslab/planx-core#03de3e0 + version: github.com/theopensystemslab/planx-core/03de3e0(@types/react@19.0.7) axios: specifier: ^1.7.4 version: 1.7.4 @@ -3060,9 +3060,9 @@ packages: resolution: {integrity: sha512-muH7gBL9sI1nciMZV67X5fTKKBLtwpZ5VBp1vsOQzj1MhrBZ4wlVCm3gedKZWLp0Oyel8sIGfeiz54Su+OVT+A==} dev: false - github.com/theopensystemslab/planx-core/6f16516(@types/react@19.0.7): - resolution: {tarball: https://codeload.github.com/theopensystemslab/planx-core/tar.gz/6f16516} - id: github.com/theopensystemslab/planx-core/6f16516 + github.com/theopensystemslab/planx-core/03de3e0(@types/react@19.0.7): + resolution: {tarball: https://codeload.github.com/theopensystemslab/planx-core/tar.gz/03de3e0} + id: github.com/theopensystemslab/planx-core/03de3e0 name: '@opensystemslab/planx-core' version: 1.0.0 prepare: true diff --git a/e2e/tests/ui-driven/package.json b/e2e/tests/ui-driven/package.json index 36ffbb49c6..e0d02121e1 100644 --- a/e2e/tests/ui-driven/package.json +++ b/e2e/tests/ui-driven/package.json @@ -9,7 +9,7 @@ }, "type": "module", "dependencies": { - "@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#6f16516", + "@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#03de3e0", "axios": "^1.7.4", "dotenv": "^16.3.1", "eslint": "^8.56.0", diff --git a/e2e/tests/ui-driven/pnpm-lock.yaml b/e2e/tests/ui-driven/pnpm-lock.yaml index 44351b6e64..5bb697c7c5 100644 --- a/e2e/tests/ui-driven/pnpm-lock.yaml +++ b/e2e/tests/ui-driven/pnpm-lock.yaml @@ -6,8 +6,8 @@ settings: dependencies: '@opensystemslab/planx-core': - specifier: git+https://github.com/theopensystemslab/planx-core#6f16516 - version: github.com/theopensystemslab/planx-core/6f16516(@types/react@19.0.7) + specifier: git+https://github.com/theopensystemslab/planx-core#03de3e0 + version: github.com/theopensystemslab/planx-core/03de3e0(@types/react@19.0.7) axios: specifier: ^1.7.4 version: 1.7.4 @@ -2614,9 +2614,9 @@ packages: resolution: {integrity: sha512-muH7gBL9sI1nciMZV67X5fTKKBLtwpZ5VBp1vsOQzj1MhrBZ4wlVCm3gedKZWLp0Oyel8sIGfeiz54Su+OVT+A==} dev: false - github.com/theopensystemslab/planx-core/6f16516(@types/react@19.0.7): - resolution: {tarball: https://codeload.github.com/theopensystemslab/planx-core/tar.gz/6f16516} - id: github.com/theopensystemslab/planx-core/6f16516 + github.com/theopensystemslab/planx-core/03de3e0(@types/react@19.0.7): + resolution: {tarball: https://codeload.github.com/theopensystemslab/planx-core/tar.gz/03de3e0} + id: github.com/theopensystemslab/planx-core/03de3e0 name: '@opensystemslab/planx-core' version: 1.0.0 prepare: true diff --git a/editor.planx.uk/package.json b/editor.planx.uk/package.json index 7ea0046fdb..437b8916b3 100644 --- a/editor.planx.uk/package.json +++ b/editor.planx.uk/package.json @@ -15,7 +15,7 @@ "@mui/material": "^5.15.10", "@mui/utils": "^5.15.11", "@opensystemslab/map": "1.0.0-alpha.4", - "@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#6f16516", + "@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#03de3e0", "@tiptap/core": "^2.4.0", "@tiptap/extension-bold": "^2.0.3", "@tiptap/extension-bubble-menu": "^2.1.13", diff --git a/editor.planx.uk/pnpm-lock.yaml b/editor.planx.uk/pnpm-lock.yaml index a9cd9dd1a8..fe8cbdf8db 100644 --- a/editor.planx.uk/pnpm-lock.yaml +++ b/editor.planx.uk/pnpm-lock.yaml @@ -48,8 +48,8 @@ dependencies: specifier: 1.0.0-alpha.4 version: 1.0.0-alpha.4 '@opensystemslab/planx-core': - specifier: git+https://github.com/theopensystemslab/planx-core#6f16516 - version: github.com/theopensystemslab/planx-core/6f16516(@types/react@18.2.45) + specifier: git+https://github.com/theopensystemslab/planx-core#03de3e0 + version: github.com/theopensystemslab/planx-core/03de3e0(@types/react@18.2.45) '@tiptap/core': specifier: ^2.4.0 version: 2.4.0(@tiptap/pm@2.0.3) @@ -13723,6 +13723,11 @@ packages: engines: {node: '>=16'} dev: false + /type-fest@4.33.0: + resolution: {integrity: sha512-s6zVrxuyKbbAsSAD5ZPTB77q4YIdRctkTbJ2/Dqlinwz+8ooH2gd+YA7VA6Pa93KML9GockVvoxjZ2vHP+mu8g==} + engines: {node: '>=16'} + dev: false + /type-is@1.6.18: resolution: {integrity: sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==} engines: {node: '>= 0.6'} @@ -14690,9 +14695,9 @@ packages: use-sync-external-store: 1.2.0(react@18.2.0) dev: false - github.com/theopensystemslab/planx-core/6f16516(@types/react@18.2.45): - resolution: {tarball: https://codeload.github.com/theopensystemslab/planx-core/tar.gz/6f16516} - id: github.com/theopensystemslab/planx-core/6f16516 + github.com/theopensystemslab/planx-core/03de3e0(@types/react@18.2.45): + resolution: {tarball: https://codeload.github.com/theopensystemslab/planx-core/tar.gz/03de3e0} + id: github.com/theopensystemslab/planx-core/03de3e0 name: '@opensystemslab/planx-core' version: 1.0.0 prepare: true @@ -14718,7 +14723,7 @@ packages: prettier: 3.4.2 react: 18.3.1 react-dom: 18.3.1(react@18.3.1) - type-fest: 4.32.0 + type-fest: 4.33.0 uuid: 11.0.5 zod: 3.24.1 transitivePeerDependencies: