From 9117b40e7b883c8eb65b9d999a8124eeef98cfc4 Mon Sep 17 00:00:00 2001 From: Timo K Date: Tue, 2 Jun 2026 13:52:43 +0200 Subject: [PATCH] fix tests --- src/room/GroupCallView.test.tsx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/room/GroupCallView.test.tsx b/src/room/GroupCallView.test.tsx index 97da083e..1576fbdc 100644 --- a/src/room/GroupCallView.test.tsx +++ b/src/room/GroupCallView.test.tsx @@ -250,10 +250,13 @@ test.skip("GroupCallView plays a leave sound synchronously in widget mode", asyn test("Should close widget when all other left and have time to play a sound", async () => { const user = userEvent.setup(); - const widgetClosedCalled = Promise.withResolvers(); + let widgetClosedCalled = false; + const { promise: widgetClosedPromise, resolve: widgetClosedResolver } = + Promise.withResolvers(); const widgetSendMock = vi.fn().mockImplementation((action: string) => { if (action === ElementWidgetActions.Close) { - widgetClosedCalled.resolve(); + widgetClosedCalled = true; + widgetClosedResolver(); } }); const widgetStopMock = vi.fn().mockResolvedValue(undefined); @@ -280,17 +283,18 @@ test("Should close widget when all other left and have time to play a sound", as const leaveButton = getByText("SimulateOtherLeft"); await user.click(leaveButton); await flushPromises(); - expect(widgetSendMock).not.toHaveBeenCalled(); + expect(widgetClosedCalled).toBeFalsy(); resolvePlaySound.resolve(); await flushPromises(); // Expect the leave sound to be played but silent (volumeOverwrite = 0) // The allOthersLeft effect should already play a leave sound for the last user in the call. expect(playSound).toHaveBeenCalledWith("left", 0); - await widgetClosedCalled.promise; + await widgetClosedPromise; await flushPromises(); + expect(widgetClosedCalled).toBeTruthy(); expect(widgetStopMock).toHaveBeenCalledOnce(); -}); +}, 80000); test("Should close widget when all other left", async () => { const user = userEvent.setup();