test(audio): passing beep plays for every car with no lock

This commit is contained in:
larssand committed 2026-11-10 22:20:27 +01:00
1 parent c07a652f8e
commit 119619d6ff
1 file changed
+12
+12
View File
@@ -387,3 +387,15 @@ test("a quick lap time call is dropped while the voice is busy", async () => {
assert.equal(await free.voiceDone, true);
assert.deepEqual(spoken, ["busy", "18 flat"]);
});
test("passing beep plays for every car, even five cars inside a second (only voice calls skip while busy)", async () => {
const played = [];
const engine = createRaceAudioEngine({
getSettings: () => ({ enabled: true }),
fetchImpl: async () => ({ ok: true, json: async () => manifest }),
audioFactory: (src) => ({ play: () => { played.push(src); return Promise.resolve(); }, volume: 1 }),
});
const calls = ["a", "b", "c", "d", "e", "a"].map((key) => engine.trigger("transponder_pass", { variant: key, scope: key }));
await Promise.all(calls.map((call) => call.effectDone));
assert.equal(played.length, 6);
});