From 1eddfe3a292eaf5e5abdf02d1cee7d9b2589744f Mon Sep 17 00:00:00 2001 From: Maurice Date: Sat, 5 Dec 2026 12:31:22 +0100 Subject: [PATCH] fix(ci): resolve remaining trip UI and contract checks Match the date badge and spotlight behavior in tests, keep stored tag data out of plugin responses, and handle missing place review text. Lower the ratchets to the counts reported by CI after the simplifications. --- client/scripts/eslint-baseline.json | 4 +-- client/scripts/size-baseline.json | 2 +- client/scripts/theme-disable-baseline.json | 2 +- .../Planner/DayPlanSidebar.test.tsx | 2 +- .../src/components/Planner/PlaceInspector.tsx | 2 +- client/src/components/Trips/TripTagField.tsx | 28 ++++++++++++++----- .../unit/mobile/dashboard/MDashboard.test.tsx | 7 +++-- .../db/repositories/Trips.repository.test.ts | 8 ++++-- .../unit/plugins/output-contract.test.ts | 4 +-- 9 files changed, 38 insertions(+), 21 deletions(-) diff --git a/client/scripts/eslint-baseline.json b/client/scripts/eslint-baseline.json index b44d6298a..e8eb2ad0a 100644 --- a/client/scripts/eslint-baseline.json +++ b/client/scripts/eslint-baseline.json @@ -12,7 +12,7 @@ "react-hooks/set-state-in-effect": 188, "@typescript-eslint/no-floating-promises": 156, "react-hooks/exhaustive-deps": 112, - "@typescript-eslint/no-unused-vars": 95, + "@typescript-eslint/no-unused-vars": 92, "react-hooks/immutability": 26, "max-lines-per-function": 125, "react-hooks/static-components": 34, @@ -35,7 +35,7 @@ }, "tests": { "@typescript-eslint/no-explicit-any": 484, - "@typescript-eslint/no-non-null-assertion": 1845, + "@typescript-eslint/no-non-null-assertion": 1844, "@typescript-eslint/no-misused-promises": 22, "@typescript-eslint/no-unused-vars": 48, "@typescript-eslint/no-floating-promises": 33, diff --git a/client/scripts/size-baseline.json b/client/scripts/size-baseline.json index d8d3b4ad5..46ea2b657 100644 --- a/client/scripts/size-baseline.json +++ b/client/scripts/size-baseline.json @@ -11,7 +11,7 @@ "src/components/Planner/DayDetailPanel.test.tsx": 2331, "src/components/Planner/DayPlanSidebar.test.tsx": 5349, "src/components/Planner/DayPlanSidebar.tsx": 2895, - "src/components/Planner/PlaceFormModal.test.tsx": 2836, + "src/components/Planner/PlaceFormModal.test.tsx": 2833, "src/components/Planner/PlaceInspector.tsx": 1014, "src/components/Studio/TravelElements.tsx": 1332, "src/components/Studio/countryShapes.ts": 2595, diff --git a/client/scripts/theme-disable-baseline.json b/client/scripts/theme-disable-baseline.json index 2d5f0a222..b4320070a 100644 --- a/client/scripts/theme-disable-baseline.json +++ b/client/scripts/theme-disable-baseline.json @@ -52,7 +52,7 @@ "components/Studio/travel/badgeLook.ts": 2, "components/Trips/TripMemberAvatar.tsx": 2, "components/Vacay/VacayPersons.tsx": 1, - "components/shared/DialogShell.tsx": 2, + "components/shared/DialogShell.tsx": 1, "components/shared/PasswordChecklist.tsx": 2, "mobile/components/MSheet.tsx": 1, "mobile/components/MWalletButton.tsx": 1, diff --git a/client/src/components/Planner/DayPlanSidebar.test.tsx b/client/src/components/Planner/DayPlanSidebar.test.tsx index 9c56f7028..9c7eb1908 100644 --- a/client/src/components/Planner/DayPlanSidebar.test.tsx +++ b/client/src/components/Planner/DayPlanSidebar.test.tsx @@ -5173,7 +5173,7 @@ describe('the day route-tools row', () => { render() const secondary = screen.getByText('Day 1') expect(secondary).toHaveClass('text-content-muted') - expect(secondary.previousElementSibling?.className).toContain('font-bold') + expect(secondary.previousElementSibling).toHaveClass('bg-surface-card') }) }) diff --git a/client/src/components/Planner/PlaceInspector.tsx b/client/src/components/Planner/PlaceInspector.tsx index 288c7b96e..9f38b3bcf 100644 --- a/client/src/components/Planner/PlaceInspector.tsx +++ b/client/src/components/Planner/PlaceInspector.tsx @@ -557,7 +557,7 @@ export default function PlaceInspector({ ) } -function InspectorRating({ place, review, onRate }: { place: Place; review?: string; onRate?: PlaceInspectorProps['onRate'] }) { +function InspectorRating({ place, review, onRate }: { place: Place; review?: string | null; onRate?: PlaceInspectorProps['onRate'] }) { const { t } = useTranslation() return ( diff --git a/client/src/components/Trips/TripTagField.tsx b/client/src/components/Trips/TripTagField.tsx index 4d48b0c6f..f47d6c17b 100644 --- a/client/src/components/Trips/TripTagField.tsx +++ b/client/src/components/Trips/TripTagField.tsx @@ -43,6 +43,26 @@ function availableTags(options: string[], selected: Set, query: string, return options.filter((tag) => !selected.has(tripTagKey(tag)) && tripTagKey(tag).includes(query)).slice(0, 6); } +function ReadOnlyTripTags({ + tags, + label, + labelClass, + className, +}: { + tags: string[]; + label: string; + labelClass: string; + className: string; +}) { + if (!tags.length) return null; + return ( +
+
{label}
+ +
+ ); +} + export function TripTagField({ tags, draft, @@ -104,13 +124,7 @@ export function TripTagField({ }; if (readOnly) { - if (!tags.length) return null; - return ( -
-
{t('mobileJourney.tags')}
- -
- ); + return ; } return ( diff --git a/client/tests/unit/mobile/dashboard/MDashboard.test.tsx b/client/tests/unit/mobile/dashboard/MDashboard.test.tsx index 8f06f1e9b..1d160ba03 100644 --- a/client/tests/unit/mobile/dashboard/MDashboard.test.tsx +++ b/client/tests/unit/mobile/dashboard/MDashboard.test.tsx @@ -393,11 +393,12 @@ describe('MDashboard', () => { expect(container.querySelector('img[src="/uploads/covers/x.jpg"]')).toBeInTheDocument(); }); - it('FE-MOB-DASH-023: a finished spotlight is labelled as recent', () => { - mocks.dash = buildDash({ spotlight: buildTrip({ start_date: iso(-20), end_date: iso(-10), day_count: 1 }) }); + it('FE-MOB-DASH-023: a finished spotlight shows its trip tags without a recent badge', () => { + mocks.dash = buildDash({ spotlight: buildTrip({ start_date: iso(-20), end_date: iso(-10), day_count: 1, tags: ['City break'] }) }); render(); - expect(screen.getByText('dashboard.hero.badgeRecent')).toBeInTheDocument(); + expect(screen.getByText('City break')).toBeInTheDocument(); + expect(screen.queryByText('dashboard.hero.badgeRecent')).not.toBeInTheDocument(); expect(screen.getByText('dashboard.mobile.spotlightDays')).toBeInTheDocument(); }); diff --git a/server/tests/unit/db/repositories/Trips.repository.test.ts b/server/tests/unit/db/repositories/Trips.repository.test.ts index 95f345183..9250c2b54 100644 --- a/server/tests/unit/db/repositories/Trips.repository.test.ts +++ b/server/tests/unit/db/repositories/Trips.repository.test.ts @@ -433,7 +433,7 @@ describe('TripsRepository.findForViewer / listForUser / activeTrip (Plan 3c Task ) .all({ userId: owner.id }); const rows = await trips.listForUser(owner.id, null); - expect(rows).toEqual(legacy.map(row => expectedTrip(row as Record))); + expect(rows).toEqual(legacy.map((row) => expectedTrip(row as Record))); expect(rows.map((r) => r.id).sort()).toEqual([owned.id, shared.id, archived.id].sort()); }); @@ -454,7 +454,9 @@ describe('TripsRepository.findForViewer / listForUser / activeTrip (Plan 3c Task `, ) .all({ userId: owner.id, archived: 1 }); - expect(await trips.listForUser(owner.id, 1)).toEqual(legacyArchived.map(row => expectedTrip(row as Record))); + expect(await trips.listForUser(owner.id, 1)).toEqual( + legacyArchived.map((row) => expectedTrip(row as Record)), + ); expect((await trips.listForUser(owner.id, 1)).map((r) => r.id)).toEqual([archived.id]); expect((await trips.listForUser(owner.id, 0)).map((r) => r.id)).toEqual([active.id]); }); @@ -1086,7 +1088,7 @@ describe('TripsRepository.listOwnedOrMember — AT1 parity with the legacy state const legacy = testDb.prepare(LEGACY_OWNED_OR_MEMBER).all(caller.id, caller.id, caller.id); const rows = await trips.listOwnedOrMember(caller.id); - expect(rows).toEqual(legacy.map(row => expectedTrip(row as Record))); + expect(rows).toEqual(legacy.map((row) => expectedTrip(row as Record))); expect(rows.map((r) => r.id)).toEqual([memberOf.id, owned.id]); }); diff --git a/server/tests/unit/plugins/output-contract.test.ts b/server/tests/unit/plugins/output-contract.test.ts index 49104e836..3d90d2ab3 100644 --- a/server/tests/unit/plugins/output-contract.test.ts +++ b/server/tests/unit/plugins/output-contract.test.ts @@ -66,8 +66,8 @@ describe('the contract table', () => { expect(fields).toEqual([...contract.columns, ...contract.derived]); }); - it('OUTCONTRACT-UNIT-004 a trip withholds its feed token and a user exposes four fields', () => { - expect(contractOf('trip').withheld).toEqual(['feed_token']); + it('OUTCONTRACT-UNIT-004 a trip withholds its feed token and stored tag data', () => { + expect(contractOf('trip').withheld).toEqual(['feed_token', 'tags_json']); expect(pluginEntityFields('user')).toEqual(['id', 'username', 'display_name', 'avatar']); });