diff --git a/ui/src/ui/views/channels.test.ts b/ui/src/ui/views/channels.test.ts index 1db3175b419..d353aabe277 100644 --- a/ui/src/ui/views/channels.test.ts +++ b/ui/src/ui/views/channels.test.ts @@ -173,7 +173,9 @@ describe("WhatsApp card actions", () => { expect(labels).not.toContain("Relink"); expect(labels).not.toContain("Wait for scan"); - buttons.find((button) => button.textContent?.trim() === "Show QR")?.click(); + const showQr = buttons.find((button) => button.textContent?.trim() === "Show QR"); + expect(showQr).toBeInstanceOf(HTMLButtonElement); + showQr!.click(); expect(onWhatsAppStart).toHaveBeenCalledWith(false); }); @@ -187,7 +189,9 @@ describe("WhatsApp card actions", () => { expect(labels).toContain("Relink"); expect(labels).not.toContain("Show QR"); - buttons.find((button) => button.textContent?.trim() === "Relink")?.click(); + const relink = buttons.find((button) => button.textContent?.trim() === "Relink"); + expect(relink).toBeInstanceOf(HTMLButtonElement); + relink!.click(); expect(onWhatsAppStart).toHaveBeenCalledWith(true); });