/* * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0 */ import React from "react"; import { render, screen } from "@testing-library/react"; import { MemoryRouter } from "react-router-dom"; import DonutChartWidget from "../DonutChartWidget"; test("renders the chart title", async () => { render( , { wrapper: MemoryRouter }, ); expect(screen.getByText("test title")).toBeInTheDocument(); }); test("renders the summary above the chart", async () => { render( , { wrapper: MemoryRouter }, ); const summary = screen.getByText("test summary"); expect(summary).toBeInTheDocument(); expect(summary.closest("div")).toHaveClass("chartSummaryAbove"); }); test("renders the summary below the chart", async () => { render( , { wrapper: MemoryRouter }, ); const summary = screen.getByText("test summary"); expect(summary).toBeInTheDocument(); expect(summary.closest("div")).toHaveClass("chartSummaryBelow"); });