mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-03 01:28:55 +00:00
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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user