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(