From e4e78a2167e4aa4690366e59aaf9fd109021810a Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 8 Oct 2026 06:15:27 +0000 Subject: [PATCH] Accept Dugdale Arts Centre's explicit empty film listing The venue currently has no films scheduled and its listing shows an explicit empty state, which the transform treated as a broken parse. Follow the Curzon Sea Containers pattern: no movies is only accepted when that marker is present. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01LRMbivcScugryXudXDv3jA --- .../tests/index.test.js | 19 +++++++++++++++++++ cinemas/dugdaleartscentre.co.uk/transform.js | 11 +++++++++-- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/cinemas/dugdaleartscentre.co.uk/tests/index.test.js b/cinemas/dugdaleartscentre.co.uk/tests/index.test.js index 1f949867..20515836 100644 --- a/cinemas/dugdaleartscentre.co.uk/tests/index.test.js +++ b/cinemas/dugdaleartscentre.co.uk/tests/index.test.js @@ -44,4 +44,23 @@ describe(attributes.name, () => { }, isRecording ? 240_000 : undefined, ); + + it("transforms the venue's explicit empty state to no movies", async () => { + const movieListPage = ` +
+
+

We don’t currently have any scheduled events that match your selection.

+
+
`; + + expect(await transform({ movieListPage, moviePages: {} }, {})).toEqual([]); + }); + + it("throws when no movies are found without the empty state", async () => { + const movieListPage = `
`; + + await expect( + transform({ movieListPage, moviePages: {} }, {}), + ).rejects.toThrow("No movies found - the page structure may have changed"); + }); }); diff --git a/cinemas/dugdaleartscentre.co.uk/transform.js b/cinemas/dugdaleartscentre.co.uk/transform.js index 226257b5..f791e4dd 100644 --- a/cinemas/dugdaleartscentre.co.uk/transform.js +++ b/cinemas/dugdaleartscentre.co.uk/transform.js @@ -33,7 +33,7 @@ const getMatchingDescription = ($description) => { return $clone.text().trim(); }; -async function transform({ moviePages }, sourcedEvents) { +async function transform({ movieListPage, moviePages }, sourcedEvents) { const movies = []; for (const [moviePageUrl, { moviePage, booking, eventId }] of Object.entries( @@ -87,7 +87,14 @@ async function transform({ moviePages }, sourcedEvents) { } if (movies.length === 0) { - throw new Error("No movies found - the page structure may have changed"); + // When the venue has no films scheduled, the listing grid holds an + // explicit empty state ("We don't currently have any scheduled events + // that match your selection") instead of events. Without that marker, no + // movies means our parsing has broken. + const $ = cheerio.load(movieListPage); + if ($(".whats-on-grid .empty").length === 0) { + throw new Error("No movies found - the page structure may have changed"); + } } const listOfSourcedEvents = Object.values(sourcedEvents).flatMap(