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.
This commit is contained in:
Maurice
2026-12-05 12:31:22 +01:00
parent 53198b4d58
commit 1eddfe3a29
9 changed files with 38 additions and 21 deletions
+2 -2
View File
@@ -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,
+1 -1
View File
@@ -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,
+1 -1
View File
@@ -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,
@@ -5173,7 +5173,7 @@ describe('the day route-tools row', () => {
render(<DayPlanSidebar {...makeDefaultProps({ days: [day], assignments: {} })} />)
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')
})
})
@@ -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 (
<DialogSection icon={Star} className={onRate ? undefined : 'hidden md:block'} label={t('places.details.fact.rating')}>
+21 -7
View File
@@ -43,6 +43,26 @@ function availableTags(options: string[], selected: Set<string>, 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 (
<div className={className}>
<div className={labelClass}>{label}</div>
<TripTagChips tags={tags} className="mt-1.5" />
</div>
);
}
export function TripTagField({
tags,
draft,
@@ -104,13 +124,7 @@ export function TripTagField({
};
if (readOnly) {
if (!tags.length) return null;
return (
<div className={className}>
<div className={labelClass}>{t('mobileJourney.tags')}</div>
<TripTagChips tags={tags} className="mt-1.5" />
</div>
);
return <ReadOnlyTripTags tags={tags} label={t('mobileJourney.tags')} labelClass={labelClass} className={className} />;
}
return (
@@ -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(<MDashboard />);
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();
});
@@ -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<string, unknown>)));
expect(rows).toEqual(legacy.map((row) => expectedTrip(row as Record<string, unknown>)));
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<string, unknown>)));
expect(await trips.listForUser(owner.id, 1)).toEqual(
legacyArchived.map((row) => expectedTrip(row as Record<string, unknown>)),
);
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<string, unknown>)));
expect(rows).toEqual(legacy.map((row) => expectedTrip(row as Record<string, unknown>)));
expect(rows.map((r) => r.id)).toEqual([memberOf.id, owned.id]);
});
@@ -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']);
});