mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-10-23 07:26:30 +00:00
fix(tours): restrict permanent deletion to tours workspace
This commit is contained in:
@@ -61,6 +61,8 @@ describe('MBrowseActionsSheet Tour assignment picker', () => {
|
||||
const planner = mobilePlanner({ handleAssignToDay });
|
||||
const { rerender, shell } = renderDayPicker(planner);
|
||||
|
||||
expect(screen.queryByRole('button', { name: 'Delete' })).not.toBeInTheDocument();
|
||||
|
||||
const dayOne = screen.getByRole('button', { name: /Day one/ });
|
||||
const dayTwo = screen.getByRole('button', { name: /Day two/ });
|
||||
expect(dayOne).toBeDisabled();
|
||||
|
||||
@@ -247,15 +247,19 @@ describe('assignmentsSlice', () => {
|
||||
});
|
||||
|
||||
it('FE-ASSIGN-004b: removeAssignment success removes from store', async () => {
|
||||
const place = buildPlace({ id: 10, trip_id: 1 });
|
||||
const place = buildPlace({ id: 10, trip_id: 1, tour_place_id: 10, route_geometry: '[[1,2],[3,4]]' });
|
||||
const assignment = buildAssignment({ id: 100, day_id: 1, place });
|
||||
const otherDayAssignment = buildAssignment({ id: 101, day_id: 2, place });
|
||||
seedStore(useTripStore, {
|
||||
assignments: { '1': [assignment] },
|
||||
places: [place],
|
||||
assignments: { '1': [assignment], '2': [otherDayAssignment] },
|
||||
});
|
||||
|
||||
await useTripStore.getState().removeAssignment(1, 1, 100);
|
||||
|
||||
expect(useTripStore.getState().assignments['1']).toHaveLength(0);
|
||||
expect(useTripStore.getState().places).toContainEqual(expect.objectContaining({ id: place.id, route_geometry: place.route_geometry }));
|
||||
expect(useTripStore.getState().assignments['2']).toEqual([otherDayAssignment]);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user