Tours: tests follow the provenance read and the shared day assignment, the tours addon ends MCP sessions, a line without a point is not copied

The repository stubs of the tour service tests answer findProvenance, which getTour and createTour read since P2C-02.
Switching the Tours addon off now ends live MCP sessions like every other addon that gates a tool (MCP-GATE-PARITY-001).
copyTour refuses a line without a point instead of placing the copy at 0/0, and new tests cover the reachable paths
of the copy, the source check and the provenance of a snapshot without its import record, including a trip copy
keeping that record. On the client the shared day assignment hands the plan exactly the tour and the day, the new
visibility store is reset between tests, and the tests of the sidebar, the detail, the phone sheet and the origin
section match the views this PR built.
This commit is contained in:
Maurice
2026-10-15 22:34:33 +00:00
parent 1d7758b819
commit 52ed63715c
16 changed files with 209 additions and 36 deletions
+1
View File
@@ -69,6 +69,7 @@ export function buildPlanner(overrides: Partial<TripPlanner> = {}): TripPlanner
reservations: [],
budgetItems: [],
files: [],
tours: [],
selectedDayId: null,
isLoading: false,
+2
View File
@@ -4,6 +4,7 @@ import { useAuthStore } from '../../src/store/authStore';
import { useInAppNotificationStore } from '../../src/store/inAppNotificationStore';
import { usePermissionsStore } from '../../src/store/permissionsStore';
import { useSettingsStore } from '../../src/store/settingsStore';
import { useTourMapVisibilityStore } from '../../src/store/tourMapVisibilityStore';
import { useTripStore } from '../../src/store/tripStore';
import { useVacayStore } from '../../src/store/vacayStore';
@@ -34,6 +35,7 @@ export const RESET_STORES: Record<string, ResettableStore> = {
useAddonStore,
useInAppNotificationStore,
usePermissionsStore,
useTourMapVisibilityStore,
};
/** Not reset so far; moving one into RESET_STORES changes what every file that resets starts from. */
@@ -1,10 +1,11 @@
import { describe, expect, it, vi } from 'vitest';
import type { TripPlanner } from '../../../../src/mobile/screens/trip/MTripShell';
import MBrowseActionsSheet from '../../../../src/mobile/screens/trip/sheets/MBrowseActionsSheet';
import { useTripStore } from '../../../../src/store/tripStore';
import type { Place } from '../../../../src/types';
import { buildPlanner, buildShell } from '../../../helpers/mobileTrip';
import { act, fireEvent, render, screen, waitFor } from '../../../helpers/render';
import { resetAllStores } from '../../../helpers/store';
import { resetAllStores, seedStore } from '../../../helpers/store';
function tourPlace(): Place {
return {
@@ -51,6 +52,8 @@ function renderDayPicker(planner = mobilePlanner()) {
describe('MBrowseActionsSheet Tour assignment picker', () => {
it('disables assigned Tour days, blocks repeat clicks, and refreshes on reopen', async () => {
resetAllStores();
// The days a tour is on are read from the trip store, the one place every tour view reads them from.
seedStore(useTripStore, { assignments: { '7': [{ id: 70, day_id: 7, place_id: 42 }] } as never });
let finishAssignment!: (assigned: boolean) => void;
const handleAssignToDay = vi.fn(
() =>
@@ -80,12 +83,12 @@ describe('MBrowseActionsSheet Tour assignment picker', () => {
});
await waitFor(() => expect(shell.closeSheet).toHaveBeenCalledOnce());
const reopened = mobilePlanner({
assignments: {
'7': [{ id: 70, day_id: 7, place_id: 42 }],
'8': [{ id: 80, day_id: 8, place_id: 42 }],
} as never,
});
const assignedAfter = {
'7': [{ id: 70, day_id: 7, place_id: 42 }],
'8': [{ id: 80, day_id: 8, place_id: 42 }],
} as never;
act(() => seedStore(useTripStore, { assignments: assignedAfter }));
const reopened = mobilePlanner({ assignments: assignedAfter });
rerender(<MBrowseActionsSheet planner={reopened} shell={shell} />);
expect(screen.getByRole('button', { name: /Day one/ })).toBeDisabled();
expect(screen.getByRole('button', { name: /Day two/ })).toBeDisabled();