From 682ae19143b5fde06372c4693ea18f650586cc22 Mon Sep 17 00:00:00 2001 From: Maurice Date: Sat, 31 Oct 2026 06:27:31 +0000 Subject: [PATCH] test(place-enrichment): a cached OSM place still reads its details for the community version An OSM element can hold community values, so the service reads its details before the cache to learn the version it is served under. The second request reads them once and then answers from the row cache without another lookup. --- server/tests/e2e/place-enrichment.e2e.test.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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).mockClear(); + (wiki.fetchCommonsCandidates as unknown as ReturnType).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 () => {