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(client): the new cases check a missing result instead of asserting it away

Mauricedbc6cb6b9445
diff --git a/client/src/components/Journey/JourneyDetailPageGalleryView.test.tsx b/client/src/components/Journey/JourneyDetailPageGalleryView.test.tsx
index 01aaff761..549a305fa 100644
--- a/client/src/components/Journey/JourneyDetailPageGalleryView.test.tsx
+++ b/client/src/components/Journey/JourneyDetailPageGalleryView.test.tsx
@@ -235,7 +235,7 @@ describe('GalleryView', () => {
await deleteThroughConfirm(user)
await waitFor(() => expect(deleted).toBe(true))
- await waitFor(() => expect(useJourneyStore.getState().current!.gallery).toHaveLength(0))
+ await waitFor(() => expect(useJourneyStore.getState().current?.gallery).toHaveLength(0))
const current = useJourneyStore.getState().current!
expect(current.gallery).toHaveLength(0)
expect(current.entries[0].photos).toHaveLength(0)
@@ -296,7 +296,7 @@ describe('GalleryView', () => {
expect(screen.queryByText('Delete photo')).not.toBeInTheDocument()
expect(deleted).toBe(false)
- expect(useJourneyStore.getState().current!.gallery).toHaveLength(1)
+ expect(useJourneyStore.getState().current?.gallery).toHaveLength(1)
expect(onPhotoClick).not.toHaveBeenCalled()
})
diff --git a/client/src/hooks/useLocationBias.test.ts b/client/src/hooks/useLocationBias.test.ts
index 6a5a937f3..b031baa56 100644
--- a/client/src/hooks/useLocationBias.test.ts
+++ b/client/src/hooks/useLocationBias.test.ts
@@ -94,8 +94,8 @@ describe('useLocationBias mit Kartenausschnitt', () => {
seed({ trip: { id: 5 }, places: [KYOTO_A, TOKIO], planMapViewport: KYOTO_VIEW });
const { box, point } = renderHook(() => useLocationBias()).result.current;
expect(box).toEqual({ low: { lat: 34.96, lng: 135.70 }, high: { lat: 35.06, lng: 135.82 } });
- expect(point!.lat).toBeCloseTo(35.01, 6);
- expect(point!.lng).toBeCloseTo(135.76, 6);
+ expect(point?.lat).toBeCloseTo(35.01, 6);
+ expect(point?.lng).toBeCloseTo(135.76, 6);
});
it('schlaegt auch den geoeffneten Tag', () => {
@@ -108,7 +108,7 @@ describe('useLocationBias mit Kartenausschnitt', () => {
planMapViewport: KYOTO_VIEW,
});
const { box } = renderHook(() => useLocationBias()).result.current;
- expect(box!.high.lng).toBeLessThan(TOKIO.lng);
+ expect(box?.high.lng).toBeLessThan(TOKIO.lng);
});
it('faellt bei einem zu weiten Ausschnitt auf den Tag zurueck', () => {