From dfd02940b5eecdc32742dc00afb4737bb311917a Mon Sep 17 00:00:00 2001 From: Maurice Date: Mon, 19 Oct 2026 23:12:30 +0200 Subject: [PATCH] test(tours): ask the trail grade cache one request after another, without an await in a loop --- server/tests/unit/nest/tour-trail-grade.service.test.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/server/tests/unit/nest/tour-trail-grade.service.test.ts b/server/tests/unit/nest/tour-trail-grade.service.test.ts index ac787db3e..a53242e06 100644 --- a/server/tests/unit/nest/tour-trail-grade.service.test.ts +++ b/server/tests/unit/nest/tour-trail-grade.service.test.ts @@ -78,10 +78,11 @@ describe('TourTrailGradeService (BIK-05)', () => { it('TOUR-GRADE-006: keeps at most fifty thousand ways, forgetting the longest kept first', async () => { query.mockResolvedValue([]); - for (let part = 0; part < 26; part += 1) { - const ids = Array.from({ length: 2000 }, (_, index) => part * 2000 + index + 1); - await service.grades({ way_ids: ids }); - } + // One request after another, as the planner sends them. + await Array.from({ length: 26 }, (_, part) => part).reduce(async (previous, part) => { + await previous; + await service.grades({ way_ids: Array.from({ length: 2000 }, (_, index) => part * 2000 + index + 1) }); + }, Promise.resolve()); query.mockClear(); // The first way was forgotten, so it is asked about again; the last one is still kept. await service.grades({ way_ids: [1] });