Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

test(places): wait for the new tag's tick, not only the tag

Maurice17b47b38b973
diff --git a/client/src/components/Planner/PlaceFormModal.tags.test.tsx b/client/src/components/Planner/PlaceFormModal.tags.test.tsx
index 214d0032e..9aeb2ece4 100644
--- a/client/src/components/Planner/PlaceFormModal.tags.test.tsx
+++ b/client/src/components/Planner/PlaceFormModal.tags.test.tsx
@@ -87,10 +87,8 @@ describe('PlaceFormModal, the tags', () => {
await user.type(field, 'Viewpoint{Enter}');
- expect(await within(tagGroup()).findByRole('button', { name: 'Viewpoint' })).toHaveAttribute(
- 'aria-pressed',
- 'true'
- );
+ // The tag reaches the trip first and is ticked a beat later, so wait for the tick itself.
+ await waitFor(() => expect(tagSwitch('Viewpoint')).toHaveAttribute('aria-pressed', 'true'));
expect(sent).toMatchObject({ name: 'Viewpoint' });
expect(field).toHaveValue('');
expect(useTripStore.getState().tripTags.map((tag) => tag.name)).toEqual(['Monument', 'Viewpoint', 'Zone']);