github.com/turbot/steampipe@v1.7.0-rc.0.0.20240517123944-7cef272d4458/ui/dashboard/src/components/snapshot/SnapshotRenderComplete/index.test.jsx (about)

     1  import React from "react";
     2  import SnapshotRenderComplete from "./index.tsx";
     3  import { DashboardContext } from "../../../hooks/useDashboard";
     4  import { render } from "@testing-library/react";
     5  import "@testing-library/jest-dom";
     6  
     7  test("return null when should not render snapshot complete div", async () => {
     8    // ARRANGE
     9    const { container } = render(
    10      <DashboardContext.Provider
    11        value={{ render: { snapshotCompleteDiv: false } }}
    12      >
    13        <SnapshotRenderComplete />
    14      </DashboardContext.Provider>
    15    );
    16  
    17    // ASSERT
    18    expect(container).toBeEmptyDOMElement();
    19  });
    20  
    21  test("return null when should not render snapshot complete div", async () => {
    22    // ARRANGE
    23    render(
    24      <DashboardContext.Provider
    25        value={{ render: { snapshotCompleteDiv: true } }}
    26      >
    27        <SnapshotRenderComplete />
    28      </DashboardContext.Provider>
    29    );
    30  
    31    // ASSERT
    32    expect(document.querySelector("#snapshot-complete")).toBeTruthy();
    33  });