mirror of
https://github.com/vector-im/element-call.git
synced 2026-07-24 19:19:21 +00:00
fix race
This commit is contained in:
@@ -272,7 +272,7 @@ test("Should close widget when all other left and have time to play a sound", as
|
|||||||
lazyActions: new LazyEventEmitter(),
|
lazyActions: new LazyEventEmitter(),
|
||||||
};
|
};
|
||||||
const resolvePlaySound = Promise.withResolvers<void>();
|
const resolvePlaySound = Promise.withResolvers<void>();
|
||||||
playSound = vi.fn().mockReturnValue(resolvePlaySound);
|
playSound = vi.fn().mockReturnValue(resolvePlaySound.promise);
|
||||||
(useAudioContext as MockedFunction<typeof useAudioContext>).mockReturnValue({
|
(useAudioContext as MockedFunction<typeof useAudioContext>).mockReturnValue({
|
||||||
playSound,
|
playSound,
|
||||||
playSoundLooping: vitest.fn(),
|
playSoundLooping: vitest.fn(),
|
||||||
@@ -285,7 +285,6 @@ test("Should close widget when all other left and have time to play a sound", as
|
|||||||
await flushPromises();
|
await flushPromises();
|
||||||
expect(widgetClosedCalled).toBeFalsy();
|
expect(widgetClosedCalled).toBeFalsy();
|
||||||
resolvePlaySound.resolve();
|
resolvePlaySound.resolve();
|
||||||
await flushPromises();
|
|
||||||
|
|
||||||
// Expect the leave sound to be played but silent (volumeOverwrite = 0)
|
// 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.
|
// The allOthersLeft effect should already play a leave sound for the last user in the call.
|
||||||
|
|||||||
Reference in New Issue
Block a user