import React from "react";
import { render } from "@testing-library/react-native";
import Badge from "./badge";
import { ThemeProvider } from "../../../theme/src/theme-context";
import Icon, { IconProps } from "../../atoms/icon/icon";
import withBadge from "./withBadge";
jest.useFakeTimers();
describe("Molecules/Badge", () => {
it("passes the snapshot test for different sizes", () => {
const tree = render(
2
2
2
2
).toJSON();
expect(tree).toMatchSnapshot();
});
it("passes the snapshot test for different variants", () => {
const tree = render(
2
NEW
).toJSON();
expect(tree).toMatchSnapshot();
});
it("passes the snapshot test for different color schemes", () => {
const tree = render(
2
2
2
2
2
).toJSON();
expect(tree).toMatchSnapshot();
});
it("passes the snapshot test for different values types", () => {
const tree = render(
23
{2}+
).toJSON();
expect(tree).toMatchSnapshot();
});
it("withBadge HOC works as expected", () => {
const Wrapper = () => {
const BadgedIcon = withBadge("28", {
placement: "topRight",
size: "s",
})(Icon);
const BadgedIconTwo = withBadge(
,
{
placement: "bottomRight",
size: "m",
}
)(Icon);
return (
<>
>
);
};
const root = render(
);
const tree = root.toJSON();
expect(tree).toMatchSnapshot();
});
it("withBadge HOC works as expected with different placements", () => {
const Wrapper = () => {
const BadgedIconTopLeft = withBadge(28, {
placement: "topLeft",
size: "s",
})(Icon);
const BadgedIconTopRight = withBadge(28, {
placement: "topRight",
size: "s",
})(Icon);
const BadgedIconBottomLeft = withBadge(28, {
placement: "bottomLeft",
size: "s",
})(Icon);
const BadgedIconBottomRight = withBadge(28, {
placement: "bottomRight",
size: "s",
})(Icon);
return (
<>
>
);
};
const root = render(
);
const tree = root.toJSON();
expect(tree).toMatchSnapshot();
});
});