This commit is contained in:
Half-Shot
2024-12-05 11:38:37 +00:00
parent c5f297d108
commit b7f55a43f8
2 changed files with 7 additions and 4 deletions

View File

@@ -48,10 +48,10 @@ export function ReactionsAudioRenderer(): ReactNode {
return;
}
if (SoundMap[reactionName]) {
audioEngineRef.current.playSound(reactionName);
void audioEngineRef.current.playSound(reactionName);
} else {
// Fallback sounds.
audioEngineRef.current.playSound("generic");
void audioEngineRef.current.playSound("generic");
}
}
}, [audioEngineRef, shouldPlay, oldReactions, reactions]);

View File

@@ -27,9 +27,11 @@ const TestComponent: FC = () => {
}
return (
<>
<button onClick={async () => audioCtx.playSound("aSound")}>Valid sound</button>
<button onClick={() => void audioCtx.playSound("aSound")}>
Valid sound
</button>
{/* eslint-disable-next-line @typescript-eslint/no-explicit-any*/}
<button onClick={async () => audioCtx.playSound("not-valid" as any)}>
<button onClick={() => void audioCtx.playSound("not-valid" as any)}>
Invalid sound
</button>
</>
@@ -59,6 +61,7 @@ class MockAudioContext {
vitest.mocked({
connect: (v: unknown) => v,
start: () => {},
addEventListener: (_eventType: string, cb: () => void) => cb(),
}),
);
public createGain = vitest.fn().mockReturnValue(this.gain);