UNPKG

@netdata/netdata-ui

Version:
29 lines 1.52 kB
import React from "react"; import { renderWithProviders, screen } from "testUtilities"; import MasterCard from "./mastercard"; describe("MasterCardPill component", function () { test("should render default component", function () { renderWithProviders(/*#__PURE__*/React.createElement(MasterCard, null)); expect(screen.queryByTestId("mastercard")).toBeInTheDocument(); expect(screen.queryByTestId("mastercard-left-pill")).toBeInTheDocument(); expect(screen.queryByTestId("mastercard-right-pill")).toBeInTheDocument(); }); test("should render component with custom test id", function () { renderWithProviders(/*#__PURE__*/React.createElement(MasterCard, { "data-testid": "custom-mastercard" })); expect(screen.queryByTestId("mastercard")).not.toBeInTheDocument(); expect(screen.queryByTestId("mastercard-left-pill")).not.toBeInTheDocument(); expect(screen.queryByTestId("mastercard-right-pill")).not.toBeInTheDocument(); expect(screen.queryByTestId("custom-mastercard")).toBeInTheDocument(); expect(screen.queryByTestId("custom-mastercard-left-pill")).toBeInTheDocument(); expect(screen.queryByTestId("custom-mastercard-right-pill")).toBeInTheDocument(); }); test("should render clickable component", function () { var mockedOnClick = jest.fn(); renderWithProviders(/*#__PURE__*/React.createElement(MasterCard, { onClick: mockedOnClick })); expect(screen.queryByTestId("mastercard")).toHaveStyleRule("cursor", "pointer"); }); });