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(place-enrichment): a cached OSM place still reads its details for the community version

Maurice682ae19143b5
diff --git a/server/tests/e2e/place-enrichment.e2e.test.ts b/server/tests/e2e/place-enrichment.e2e.test.ts
index cff2e9208..fbafb4b03 100644
--- a/server/tests/e2e/place-enrichment.e2e.test.ts
+++ b/server/tests/e2e/place-enrichment.e2e.test.ts
@@ -201,10 +201,14 @@ describe('Place enrichment e2e (real auth guard + real validation pipe)', () =>
expect(first.body.description).toMatchObject({ text: 'Ein Museum in Köln.', source: 'osm', license: 'ODbL 1.0' });
(maps.details as unknown as ReturnType<typeof vi.fn>).mockClear();
+ (wiki.fetchCommonsCandidates as unknown as ReturnType<typeof vi.fn>).mockClear();
const second = await request(server).post('/api/maps/enrichment').set('Cookie', sessionCookie(1)).send(BODY);
expect(second.body.description).toEqual(first.body.description);
- expect(maps.details).not.toHaveBeenCalled();
+ // An OSM element can hold community values, so its details are read once
+ // for the community version before the cache; nothing else runs again.
+ expect(maps.details).toHaveBeenCalledTimes(1);
+ expect(wiki.fetchCommonsCandidates).not.toHaveBeenCalled();
});
it('200 with the stored credit for a cached picture', async () => {