mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-11-21 19:40:34 +00:00
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.
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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 } }))
|
||||
|
||||
@@ -26,7 +26,7 @@ const ICONS: Readonly<Record<string, LucideIcon>> = {
|
||||
};
|
||||
|
||||
/** One trip addon as the trip settings list it. */
|
||||
export interface TripAddonRow {
|
||||
interface TripAddonRow {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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');
|
||||
|
||||
Reference in New Issue
Block a user