@netdata/netdata-ui
Version:
netdata UI kit
30 lines • 1.38 kB
JavaScript
import React from "react";
import { renderWithProviders, screen } from "testUtilities";
import MasterCardPill from "./mastercardPill";
describe("MasterCardPill component", function () {
test("should render default component", function () {
renderWithProviders(/*#__PURE__*/React.createElement(MasterCardPill, null));
expect(screen.queryByTestId("mastercard-pill")).toBeInTheDocument();
expect(screen.queryByTestId("mastercard-pill")).toHaveTextContent("-");
});
test("should render component with custom test id", function () {
renderWithProviders(/*#__PURE__*/React.createElement(MasterCardPill, {
"data-testid": "custom-mastercard-pill"
}));
expect(screen.queryByTestId("mastercard-pill")).not.toBeInTheDocument();
expect(screen.queryByTestId("custom-mastercard-pill")).toBeInTheDocument();
});
test("should render component with text", function () {
var mockedText = "sample";
renderWithProviders(/*#__PURE__*/React.createElement(MasterCardPill, {
text: mockedText
}));
expect(screen.queryByTestId("mastercard-pill")).toHaveTextContent(mockedText);
});
test("should render component with icon", function () {
renderWithProviders(/*#__PURE__*/React.createElement(MasterCardPill, {
icon: "alarm_bell"
}));
expect(screen.queryByTestId("mastercard-pill")).not.toHaveTextContent("-");
});
});