From 63e9e19490d56784b8fec2ef82200bc998999689 Mon Sep 17 00:00:00 2001 From: Claude Date: Wed, 11 Nov 2026 07:42:32 +0000 Subject: [PATCH] Parse a Tito event's time only once it matches a venue Tito lists every event an organiser runs, and one in Canterbury with a date and no time failed transform-prepare for every venue. The calendar text is now parsed after the venue match, so such an event still stops the run at a venue we carry and is passed over anywhere else. Co-Authored-By: Claude Fable 5.2 Claude-Session: https://claude.ai/code/session_01GBhsxWaH5bizzTJXocRH48 --- sources/ti.to/find-events.js | 14 +++++--- sources/ti.to/tests/index.test.js | 55 +++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 5 deletions(-) diff --git a/sources/ti.to/find-events.js b/sources/ti.to/find-events.js index 03b0729b..f8593a83 100644 --- a/sources/ti.to/find-events.js +++ b/sources/ti.to/find-events.js @@ -166,7 +166,7 @@ function extractEventDetails(html, url) { venueName: locationText, venueAddress: locationText, coordinates: null, - parsedDate: parseCalText(calText), + calText, description, }; } @@ -176,20 +176,24 @@ function extractEventDetails(html, url) { // First segment of venue address is the venue name const venueName = venueAddress.split(",")[0].trim(); - const parsedDate = parseCalText(calText); - return { title, venueName, venueAddress, coordinates, - parsedDate, + calText, description, }; } function convertTitoEvent(url, eventDetails) { - const { title, parsedDate, description } = eventDetails; + const { title, calText, description } = eventDetails; + // Parsed only once the event is known to be at one of our venues. Tito + // lists every event an organiser runs, and one elsewhere in the country + // with a date and no time ("November 16th, 2026") has no performance to + // give - which should stop the run for a venue we carry, and not for one + // we don't. + const parsedDate = parseCalText(calText); const eventPath = extractEventPath(url); const duration = differenceInMinutes( parsedDate.endDate, diff --git a/sources/ti.to/tests/index.test.js b/sources/ti.to/tests/index.test.js index dcdca875..3e5e3b57 100644 --- a/sources/ti.to/tests/index.test.js +++ b/sources/ti.to/tests/index.test.js @@ -159,4 +159,59 @@ describe(`${attributes.name}`, () => { expect(output).toHaveLength(0); }); }); + + // Markup from https://ti.to/queereast/girlfriends_uok_2026, which gives a + // date and no time + describe("an event with a date and no time", () => { + const html = ` +

Girlfriends (University of Kent)

+ + + `; + const venues = { + queereast: { + moviePages: { + "https://ti.to/queereast/girlfriends_uok_2026": html, + }, + }, + }; + + it("is passed over for a cinema it isn't at", async () => { + readJSON.mockImplementation(() => venues); + + const output = await findEvents({ + name: "The Garden Cinema", + alternativeNames: [], + address: "39-41 Parker St, London WC2B 5PQ, UK", + geo: { lat: 51.5162287, lon: -0.1213371 }, + }); + + expect(output).toHaveLength(0); + }); + + it("throws for the cinema it is at", async () => { + readJSON.mockImplementation(() => venues); + + await expect( + findEvents({ + name: "Lupino Cinema at the University of Kent", + alternativeNames: [], + address: "Grimond Building, University of Kent, Canterbury, CT2 7NG", + geo: { lat: 51.2967395, lon: 1.0630042 }, + }), + ).rejects.toThrow( + 'Expected en-dash in calendar text: "November 16th, 2026"', + ); + }); + }); });