From 05b453b493e74ed2eb5d86bc30ff86f9ad3bfa54 Mon Sep 17 00:00:00 2001 From: Maurice Date: Tue, 22 Sep 2026 02:18:51 +0000 Subject: [PATCH] fix(help): the collection helper belongs beside the scripts, not inside them --- client/e2e/help/trip-place.guide.ts | 40 ++++++++++++++--------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/client/e2e/help/trip-place.guide.ts b/client/e2e/help/trip-place.guide.ts index 1a610244c..01f6fd207 100644 --- a/client/e2e/help/trip-place.guide.ts +++ b/client/e2e/help/trip-place.guide.ts @@ -113,6 +113,26 @@ const closeModal = async (page: Page): Promise => { const only = (target: (p: Page) => Locator) => ({ target }) +/** + * Take a place out of every collection it sits in. + * + * Run before the guide as well as after it: the Collections screen's own guides + * run earlier in the suite and leave places saved, and a place that is already + * in a list offers Saved where this guide's first step looks for Save to + * Collection. + */ +async function unsaveEverywhere(page: Page, name: string): Promise { + const place = await findPlace(page, name) + if (!place) return + const query = new URLSearchParams({ name: place.name, lat: String(place.lat ?? ''), lng: String(place.lng ?? '') }) + const res = await page.request.get(`/api/addons/collections/membership?${query.toString()}`) + if (!res.ok()) return + const body = (await res.json()) as { lists?: { place_id: number }[] } + for (const entry of body.lists ?? []) { + await page.request.delete(`/api/addons/collections/places/${entry.place_id}`) + } +} + const SCRIPTS: Record = { 'read-place': { guide: guide('read-place'), @@ -384,26 +404,6 @@ const SCRIPTS: Record = { only(p => footer(p).getByRole('button', { name: 'Open Website' })), ], }, -/** - * Take a place out of every collection it sits in. - * - * Run before the guide as well as after it: the Collections screen's own guides - * run earlier in the suite and leave places saved, and a place that is already - * in a list offers Saved where this guide's first step looks for Save to - * Collection. - */ -async function unsaveEverywhere(page: Page, name: string): Promise { - const place = await findPlace(page, name) - if (!place) return - const query = new URLSearchParams({ name: place.name, lat: String(place.lat ?? ''), lng: String(place.lng ?? '') }) - const res = await page.request.get(`/api/addons/collections/membership?${query.toString()}`) - if (!res.ok()) return - const body = (await res.json()) as { lists?: { place_id: number }[] } - for (const entry of body.lists ?? []) { - await page.request.delete(`/api/addons/collections/places/${entry.place_id}`) - } -} - 'place-to-collection': { guide: guide('place-to-collection'), start: async p => {