From f2bdc8c111fff25f05ecbb0a2a0c4f4ba06e6ebc Mon Sep 17 00:00:00 2001 From: junkerderprovinz Date: Fri, 9 Oct 2026 20:55:45 +0200 Subject: [PATCH] test(ui): leave songs without ReplayGain tags unaffected by the pre-amp Signed-off-by: junkerderprovinz --- ui/src/utils/calculateReplayGain.test.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ui/src/utils/calculateReplayGain.test.js b/ui/src/utils/calculateReplayGain.test.js index 0b257ba48..a74c44ab3 100644 --- a/ui/src/utils/calculateReplayGain.test.js +++ b/ui/src/utils/calculateReplayGain.test.js @@ -56,6 +56,17 @@ describe('calculateGain', () => { expect(result).toBe(1) }) + it.each(['album', 'track'])( + 'does not apply the pre-amp in %s mode to a song without gain tags', + (gainMode) => { + const result = calculateGain( + { gainMode, preAmp: 6 }, + { ...nativeTrackOnlySong, rgTrackGain: null, rgTrackPeak: null }, + ) + expect(result).toBe(1) + }, + ) + it('uses track gain in track mode', () => { const result = calculateGain({ gainMode: 'track', preAmp }, albumSong) expect(result).toBeCloseTo(10 ** (-3 / 20))