fix(audio): speak lap times as seconds with hundredths, no leading zero (1.59.1)

This commit is contained in:
larssand committed 2026-11-05 07:52:04 +01:00
1 parent db6a9f19e4
commit 12572ee31c
8 files changed
+35 -9

No files matched your search

+9 -1
View File
@@ -1,6 +1,6 @@
import test from "node:test";
import assert from "node:assert/strict";
import { RACE_AUDIO_EVENT_DEFINITIONS, createRaceAudioEngine, normalizeRaceAudioSettings, isSilencedDuringRace } from "../src/race_audio.js";
import { RACE_AUDIO_EVENT_DEFINITIONS, createRaceAudioEngine, normalizeRaceAudioSettings, isSilencedDuringRace, formatSpokenLapTime } from "../src/race_audio.js";
const manifest = {
events: { transponder_pass: { effect: "effects/transponder_pass.wav" }, start_tone: { effect: "effects/start_beep.wav" } },
@@ -325,3 +325,11 @@ test("the start and finish signals are chosen in Settings: tone and stop signal
}
assert.equal(normalizeRaceAudioSettings({ startSound: "nope" }).startSound, "tone");
});
test("lap times are spoken as seconds with hundredths, no leading zero minute", () => {
assert.equal(formatSpokenLapTime(17189, "sv"), "17,18");
assert.equal(formatSpokenLapTime(17189, "en"), "17.18");
assert.equal(formatSpokenLapTime(9050, "sv"), "9,05");
assert.equal(formatSpokenLapTime(65320, "sv"), "1 minut 5,32");
assert.equal(formatSpokenLapTime(125000, "en"), "2 minutes 5.00");
});