refactor: drop two returns that could only ever say one thing

Both functions had two exits handing back the identical value, which reads as a
decision and is none — Sonar's S3516, and the last two Blockers on the backend.

colorizeImportedTracks returned the very object it was given, coloured in place.
Saying `void` and letting the two importers return their own result is what the
function was doing all along. PLACES-SVC-005 checked the pass-through and now
checks the thing worth checking: an empty import writes no colours.

acceptInvite bailed out early on a refusal only to return the same result the
line below returns. The notification is what the early exit was really skipping,
so it is the notification that gets the condition.
This commit is contained in:
Maurice
2026-08-25 10:45:14 +02:00
committed by Maurice
parent fb76074e7c
commit 40957e909b
3 changed files with 21 additions and 11 deletions
@@ -1157,11 +1157,14 @@ describe('PlacesService — automatic track colours (#776)', () => {
expect(new Set(colors).size).toBe(colors.length);
});
it('PLACES-SVC-005 — an import that yields nothing is passed straight through', () => {
it('PLACES-SVC-005 — an import that yields nothing colours nothing', () => {
const { user } = createUser(testDb);
const trip = createTrip(testDb, user.id);
expect((svc as any).colorizeImportedTracks(String(trip.id), null)).toBeNull();
expect((svc as any).colorizeImportedTracks(String(trip.id), { places: [] })).toEqual({ places: [] });
expect(() => (svc as any).colorizeImportedTracks(String(trip.id), null)).not.toThrow();
expect(() => (svc as any).colorizeImportedTracks(String(trip.id), { places: [] })).not.toThrow();
expect(tracksOf(trip.id)).toEqual([]);
});
});