From a500915c436415ed91b9130820da492bab3d9876 Mon Sep 17 00:00:00 2001 From: Valere Date: Thu, 9 Oct 2025 19:24:44 +0200 Subject: [PATCH] test: Fix mute test, behavior change from setMuted to setAudioEnabled useCallViewKeyboardShortcuts() changed a param from `setMicrophoneMuted` to `setAudioEnabled`, the boolean arg of the callback is inverse tht it used to be --- src/useCallViewKeyboardShortcuts.test.tsx | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/useCallViewKeyboardShortcuts.test.tsx b/src/useCallViewKeyboardShortcuts.test.tsx index 86e1b03f..e22380d1 100644 --- a/src/useCallViewKeyboardShortcuts.test.tsx +++ b/src/useCallViewKeyboardShortcuts.test.tsx @@ -23,14 +23,14 @@ import { // The TestComponent just wraps a button around that hook. interface TestComponentProps { - setMicrophoneMuted?: (muted: boolean) => void; + setAudioEnabled?: (enabled: boolean) => void; onButtonClick?: () => void; sendReaction?: () => void; toggleHandRaised?: () => void; } const TestComponent: FC = ({ - setMicrophoneMuted = (): void => {}, + setAudioEnabled = (): void => {}, onButtonClick = (): void => {}, sendReaction = (reaction: ReactionOption): void => {}, toggleHandRaised = (): void => {}, @@ -40,7 +40,7 @@ const TestComponent: FC = ({ ref, () => {}, () => {}, - setMicrophoneMuted, + setAudioEnabled, sendReaction, toggleHandRaised, ); @@ -57,12 +57,13 @@ test("spacebar unmutes", async () => { render( (muted = false)} - setMicrophoneMuted={(m) => { - muted = m; + setAudioEnabled={(m) => { + muted = !m; }} />, ); + expect(muted).toBe(true); await user.keyboard("[Space>]"); expect(muted).toBe(false); await user.keyboard("[/Space]"); @@ -73,15 +74,15 @@ test("spacebar unmutes", async () => { test("spacebar prioritizes pressing a button", async () => { const user = userEvent.setup(); - const setMuted = vi.fn(); + const setAudioEnabled = vi.fn(); const onClick = vi.fn(); render( - , + , ); await user.tab(); // Focus the button await user.keyboard("[Space]"); - expect(setMuted).not.toBeCalled(); + expect(setAudioEnabled).not.toBeCalled(); expect(onClick).toBeCalled(); }); @@ -129,7 +130,7 @@ test("unmuting happens in place of the default action", async () => { tabIndex={0} onKeyDown={(e) => defaultPrevented(e.isDefaultPrevented())} > - {}} /> + {}} /> , );