Skip to content
Snippets Groups Projects
Unverified Commit ce207448 authored by Ryan Laurie's avatar Ryan Laurie Committed by GitHub
Browse files

add warnings component tests (#23203)

parent 5954fc0f
No related branches found
No related tags found
No related merge requests found
import React from "react";
import { render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import Warnings from "metabase/query_builder/components/Warnings";
describe("Warnings", () => {
it("should render a warning icon", () => {
render(<Warnings warnings={["foo"]} />);
expect(screen.getByLabelText("warning icon"));
});
it("should render a warning message tooltip on hover", () => {
render(<Warnings warnings={["test warning message"]} />);
userEvent.hover(screen.getByLabelText("warning icon"));
screen.getByText("test warning message");
});
it("should render multiple warnings", () => {
const warningMessages = ["foo", "bar", "baz"];
render(<Warnings warnings={warningMessages} />);
userEvent.hover(screen.getByLabelText("warning icon"));
warningMessages.forEach(message => {
screen.getByText(message);
});
});
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment