From 102542c1b08d8630253c0ea1003a1f752f58bb57 Mon Sep 17 00:00:00 2001 From: Timo K Date: Mon, 11 May 2026 18:18:40 +0200 Subject: [PATCH] update tests --- src/components/CallFooterViewModel.test.ts | 26 +++++++--------------- src/widget.ts | 2 +- 2 files changed, 9 insertions(+), 19 deletions(-) diff --git a/src/components/CallFooterViewModel.test.ts b/src/components/CallFooterViewModel.test.ts index 601a8393..94549b32 100644 --- a/src/components/CallFooterViewModel.test.ts +++ b/src/components/CallFooterViewModel.test.ts @@ -87,12 +87,12 @@ const twoMicsAndOneCamMediaDevices = mockMediaDevices({ describe("createCallFooterViewModel", () => { describe("audioOptions and videoOptions", () => { - it("are empty when the layout is PiP on desktop", () => { - platformMock.mockReturnValue("desktop"); + function checkEmptyFor(platform: string, layout: Layout): void { + platformMock.mockReturnValue(platform); const vm = createCallFooterViewModel( testScope(), - buildMinimalCallViewModel(pipLayout), + buildMinimalCallViewModel(layout), mockMuteStates(), twoMicsAndOneCamMediaDevices, /* openSettings */ undefined, @@ -101,23 +101,13 @@ describe("createCallFooterViewModel", () => { expect(vm.audioOptions$?.value).toEqual([]); expect(vm.videoOptions$?.value).toEqual([]); + } + it("are empty when both the platform is iOS", () => { + checkEmptyFor("ios", gridLayout); + it("are empty when both the layout is pip", () => { + checkEmptyFor("desktop", pipLayout); }); - it("are empty when the platform is iOS regardless of layout", () => { - platformMock.mockReturnValue("ios"); - - const vm = createCallFooterViewModel( - testScope(), - buildMinimalCallViewModel(gridLayout), - mockMuteStates(), - twoMicsAndOneCamMediaDevices, - /* openSettings */ undefined, - /* reactionIdentifier */ undefined, - ); - - expect(vm.audioOptions$?.value).toEqual([]); - expect(vm.videoOptions$?.value).toEqual([]); - }); it("are populated when the platform is desktop and the layout is not PiP", () => { platformMock.mockReturnValue("desktop"); diff --git a/src/widget.ts b/src/widget.ts index 2ec76e15..462fc6e0 100644 --- a/src/widget.ts +++ b/src/widget.ts @@ -61,7 +61,7 @@ export interface WidgetHelpers { * is initialized with `initializeWidget`. This should happen at the top level because the widget messaging * needs to be set up ASAP on load to ensure it doesn't miss any requests. */ -export let widget: WidgetHelpers | null; +export let widget: WidgetHelpers | null = null; /** * Should be called as soon as possible on app start. (In the initilizer before react)