From 1824cc77ec7e754aa0b635680a4f567ca4751740 Mon Sep 17 00:00:00 2001 From: Maurice Date: Sat, 21 Nov 2026 14:00:02 +0100 Subject: [PATCH] fix(ci): bring the per-trip addon tests and ratchets in step The second run of #3157 was red in six jobs: - Server types: ReminderJobsService takes AddonsService now; RJOB-007 built it with five arguments. - Server tests 2/10: the doc-sync job tests stubbed AddonsService without isEnabledForTrip, which the sync asks per trip now. - Client tests 4/10: toursPermissions mocked useAuthStore as a bare selector; tripAddonsStore keys its lists by account through getState. - Server lint (knip): TripAddonRow was exported without a reader outside its file. - Client lint and Client types: no-unused-vars and the strict errors in useTripPlanner.ts went down by one, so their entries are lowered. --- client/scripts/eslint-baseline.json | 2 +- client/scripts/strict-baseline.json | 2 +- client/src/components/Tours/toursPermissions.test.tsx | 2 +- client/src/components/Trips/useTripAddonRows.ts | 2 +- server/tests/unit/nest/doc-sync/doc-sync.job.test.ts | 5 ++++- server/tests/unit/nest/reminder-jobs.service.test.ts | 1 + 6 files changed, 9 insertions(+), 5 deletions(-) diff --git a/client/scripts/eslint-baseline.json b/client/scripts/eslint-baseline.json index 57a40c386..9dd0c5e48 100644 --- a/client/scripts/eslint-baseline.json +++ b/client/scripts/eslint-baseline.json @@ -12,7 +12,7 @@ "react-hooks/set-state-in-effect": 189, "@typescript-eslint/no-floating-promises": 162, "react-hooks/exhaustive-deps": 113, - "@typescript-eslint/no-unused-vars": 121, + "@typescript-eslint/no-unused-vars": 120, "react-hooks/immutability": 28, "max-lines-per-function": 127, "react-hooks/static-components": 50, diff --git a/client/scripts/strict-baseline.json b/client/scripts/strict-baseline.json index 7776d1193..39862b5de 100644 --- a/client/scripts/strict-baseline.json +++ b/client/scripts/strict-baseline.json @@ -129,7 +129,7 @@ "src/pages/tripPlanner/usePlaceEdits.ts": 2, "src/pages/tripPlanner/usePlaceFormOpeners.test.ts": 2, "src/pages/tripPlanner/usePlaceFormOpeners.ts": 1, - "src/pages/tripPlanner/useTripPlanner.ts": 2, + "src/pages/tripPlanner/useTripPlanner.ts": 1, "src/repo/tripRepo.ts": 2, "src/store/slices/budgetSlice.test.ts": 1, "src/utils/formatters.test.ts": 1, diff --git a/client/src/components/Tours/toursPermissions.test.tsx b/client/src/components/Tours/toursPermissions.test.tsx index 9081f5a21..798538618 100644 --- a/client/src/components/Tours/toursPermissions.test.tsx +++ b/client/src/components/Tours/toursPermissions.test.tsx @@ -23,7 +23,7 @@ const state = vi.hoisted(() => ({ })) vi.mock('../../store/tripStore', () => ({ useTripStore: (selector: (store: unknown) => unknown) => selector({ trip: state.trip, loadTrip: state.loadTrip, refreshPlaces: state.refreshPlaces, places: [], packingItems: state.packingItems }) })) -vi.mock('../../store/authStore', () => ({ useAuthStore: (selector: (store: unknown) => unknown) => selector({ user: state.user }) })) +vi.mock('../../store/authStore', () => ({ useAuthStore: Object.assign((selector: (store: unknown) => unknown) => selector({ user: state.user }), { getState: () => ({ user: state.user }) }) })) vi.mock('../../store/settingsStore', () => ({ useSettingsStore: (selector: (store: unknown) => unknown) => selector({ settings: { distance_unit: 'metric' } }) })) vi.mock('../Map/MapViewAuto', () => ({ MapViewAuto: () => null })) vi.mock('../../repo/tourRepo', () => ({ tourRepo: { importGpx: state.importGpx, previewGpx: state.previewGpx, create: state.create, update: state.update, detail: state.detail } })) diff --git a/client/src/components/Trips/useTripAddonRows.ts b/client/src/components/Trips/useTripAddonRows.ts index 7200f2055..0b0fba99a 100644 --- a/client/src/components/Trips/useTripAddonRows.ts +++ b/client/src/components/Trips/useTripAddonRows.ts @@ -26,7 +26,7 @@ const ICONS: Readonly> = { }; /** One trip addon as the trip settings list it. */ -export interface TripAddonRow { +interface TripAddonRow { id: string; name: string; description: string; diff --git a/server/tests/unit/nest/doc-sync/doc-sync.job.test.ts b/server/tests/unit/nest/doc-sync/doc-sync.job.test.ts index 0ebcd07d9..1d6decccc 100644 --- a/server/tests/unit/nest/doc-sync/doc-sync.job.test.ts +++ b/server/tests/unit/nest/doc-sync/doc-sync.job.test.ts @@ -454,7 +454,10 @@ describe('DocSyncJob and a provider switched off in the admin panel', () => { const paperless = fakeProvider('paperless'); const nextcloud = fakeProvider('nextcloud'); - const addons = { isAddonEnabled: vi.fn(() => true) } as unknown as AddonsService; + const addons = { + isAddonEnabled: vi.fn(() => true), + isEnabledForTrip: vi.fn(async () => true), + } as unknown as AddonsService; const registry = new DocumentProviderRegistry([paperless, nextcloud] as unknown as DocumentProvider[]); // Built in beforeAll: DocSyncConfigService and DocSyncService now take a // UnitOfWork, and createTestUnitOfWork is async — module-scope construction diff --git a/server/tests/unit/nest/reminder-jobs.service.test.ts b/server/tests/unit/nest/reminder-jobs.service.test.ts index 5a2b2916f..ee908b1ee 100644 --- a/server/tests/unit/nest/reminder-jobs.service.test.ts +++ b/server/tests/unit/nest/reminder-jobs.service.test.ts @@ -261,6 +261,7 @@ describe('trip reminder tick', () => { { listDueForReminder: throwGone, claimReminder: throwGone } as unknown as TodoItemsRepository, broken, { isEnabled: () => true, register: () => true, unregister: () => {} } as unknown as CronRegistrarService, + addonsSvc, ); await expect(svc.tripTick()).resolves.toBeUndefined(); expect(logMock.logError).toHaveBeenCalledWith('Trip reminder check failed: db gone');