diff --git a/server/server.js b/server/server.js index 7aef638..ab6e879 100644 --- a/server/server.js +++ b/server/server.js @@ -7,7 +7,7 @@ const app = express(); app.use(cors()); // Configuration for the proxy -const API_SERVICE_URL = "https://api.futurelabourmps.com/A3:AT65"; +const API_SERVICE_URL = "https://api.futurelabourmps.com/A3:AT70"; app.use( "/api", diff --git a/src/data/utils/string.test.ts b/src/data/utils/string.test.ts index c514d11..a26ec21 100644 --- a/src/data/utils/string.test.ts +++ b/src/data/utils/string.test.ts @@ -8,6 +8,13 @@ describe("extractLinks", () => { expect(formatted.content).toEqual(["Something something"]); }); + const pointyBrackets = "Something something "; + it("splits a simple content format", () => { + const formatted = extractLinks(basic); + expect(formatted.link?.[0]).toEqual("https://something.com"); + expect(formatted.content).toEqual(["Something something"]); + }); + const sandwich = "Something something https://something.com | Bleep bloop"; it("splits a simple content format", () => { const formatted = extractLinks(sandwich); diff --git a/src/data/utils/string.ts b/src/data/utils/string.ts index db1b121..5cc0fb7 100644 --- a/src/data/utils/string.ts +++ b/src/data/utils/string.ts @@ -1,4 +1,5 @@ -const urlRegex = /(https?:\/\/[^ ]*)/; +const urlRegex = /(https?:\/\/[^ ]*)/g; +const bracketRegex = /[<>]/g; /** * Given a content string including a hyperlink in <> parentheses, separates into content and link @@ -13,6 +14,7 @@ export const extractLinks = ( } const content = raw + .replace(bracketRegex, " ") .replace(urlRegex, "") .split("|") .filter((string) => string !== "") diff --git a/src/data/utils/utils.test.ts b/src/data/utils/utils.test.ts index 2dea4a3..6090139 100644 --- a/src/data/utils/utils.test.ts +++ b/src/data/utils/utils.test.ts @@ -95,7 +95,6 @@ const expectedValues = [ positive: undefined, }, }, - notes: "", }, { name: "Roisin McKenna Favier", @@ -161,7 +160,6 @@ const expectedValues = [ positive: undefined, }, }, - notes: "", }, { name: "Martin Rhodes", @@ -229,7 +227,6 @@ const expectedValues = [ positive: undefined, }, }, - notes: "", }, { name: "Michael Shanks MP", @@ -299,7 +296,6 @@ const expectedValues = [ positive: undefined, }, }, - notes: "", }, { name: "John Grady", @@ -369,7 +365,6 @@ const expectedValues = [ positive: undefined, }, }, - notes: "", }, { name: "Gordon McKee", @@ -430,7 +425,6 @@ const expectedValues = [ positive: undefined, }, }, - notes: "", }, ];