test(journey): pin the capture hint through the upload routes and the shared contract

This commit is contained in:
Maurice
2026-11-30 14:39:39 +01:00
parent 78c0f65de4
commit e59cd23e60
4 changed files with 31 additions and 4 deletions
+1 -1
View File
@@ -625,7 +625,7 @@ describe('Journey e2e (real auth guard + temp SQLite)', () => {
expect(res.body.photos).toHaveLength(1);
// The capture backfill runs for the upload (and may place its entry, #1003)...
await new Promise((resolve) => setTimeout(resolve, 10));
expect(backfillRun).toHaveBeenCalledWith([90], 1);
expect(backfillRun).toHaveBeenCalledWith([90], 1, undefined);
// ...but no journey refresh follows: a bulk upload would otherwise reload
// every open client once per photo.
expect(jsvc.broadcastJourneyEvent).not.toHaveBeenCalled();
@@ -199,10 +199,20 @@ describe('JourneyController', () => {
]);
// The client uploads one file per request, so a refresh per upload would
// reload every open client once per photo: uploads backfill and stay quiet.
// No capture fields came along, so no hint does either (#3120).
expect(scheduleUpload.mock.calls).toEqual([
[[entryPhoto], 1],
[[galleryPhoto], 1],
[[entryPhoto], 1, null],
[[galleryPhoto], 1, null],
]);
scheduleUpload.mockClear();
const fields = { taken_at: '2026-05-30T13:52:19.000Z', lat: '64.1466000', lng: '-21.9426000' };
const hint = { takenAt: '2026-05-30T13:52:19.000Z', lat: 64.1466, lng: -21.9426 };
await c.uploadGalleryPhotos(user, '9', [{ filename: 'g.jpg' } as Express.Multer.File], fields);
await c.uploadEntryPhotos(user, '3', [{ filename: 'a.jpg', originalname: 'a.jpg' } as Express.Multer.File], fields);
// Two files in one request: the hint names neither of them.
const two = [{ filename: 'g.jpg' }, { filename: 'h.jpg' }] as Express.Multer.File[];
await c.uploadGalleryPhotos(user, '9', two, fields);
expect(scheduleUpload.mock.calls.map((call) => call[2])).toEqual([hint, hint, null]);
});
it('link-photo: 400 without id (accepts legacy photo_id), 403, success, and the asking tab is skipped', async () => {