From 9f2f10262cf1c6736c3248d0eab102027ef03993 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Aaron?= Date: Sun, 6 Aug 2023 12:18:47 +0200 Subject: [PATCH] fix: unit tests --- .../screens/Home/DefaultView/index.test.tsx | 33 ++++++++++++++++--- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/src/app/screens/Home/DefaultView/index.test.tsx b/src/app/screens/Home/DefaultView/index.test.tsx index 0cd096f30e..6ce9e420ea 100644 --- a/src/app/screens/Home/DefaultView/index.test.tsx +++ b/src/app/screens/Home/DefaultView/index.test.tsx @@ -1,3 +1,5 @@ +import { AccountsProvider } from "../../../context/AccountsContext"; +import DefaultView from "./index"; import { render, screen } from "@testing-library/react"; import { I18nextProvider } from "react-i18next"; import { MemoryRouter } from "react-router-dom"; @@ -5,9 +7,6 @@ import { settingsFixture as mockSettings } from "~/../tests/fixtures/settings"; import i18n from "~/../tests/unit/helpers/i18n"; import { BatteryFixture } from "~/fixtures/battery"; -import { AccountsProvider } from "../../../context/AccountsContext"; -import DefaultView from "./index"; - jest.mock("~/common/lib/api", () => ({ getPayments: () => { return { @@ -66,7 +65,7 @@ describe("DefaultView", () => { expect(await screen.findByText("Send")).toBeInTheDocument(); expect(await screen.findByText("Receive")).toBeInTheDocument(); }); - test("render DefaultView with battery", async () => { + test("render DefaultView with publisher widget if enabled", async () => { const battery = BatteryFixture[0]; render( @@ -74,6 +73,7 @@ describe("DefaultView", () => { @@ -87,4 +87,29 @@ describe("DefaultView", () => { expect(await screen.findByText(battery.name)).toBeInTheDocument(); expect(await screen.findByText(battery.description)).toBeInTheDocument(); }); + + test("render DefaultView without PublisherWidget if disabled", async () => { + const battery = BatteryFixture[0]; + render( + + + + + + + + ); + + expect( + await screen.queryByText("⚡️ Send Satoshis ⚡️") + ).not.toBeInTheDocument(); + expect(await screen.queryByText(battery.name)).not.toBeInTheDocument(); + expect( + await screen.queryByText(battery.description) + ).not.toBeInTheDocument(); + }); });