@kiwicom/orbit-components
Version:
<div align="center"> <a href="https://orbit.kiwi" target="_blank"> <img alt="orbit-components" src="https://orbit.kiwi/wp-content/uploads/2018/08/orbit-components.png" srcset="https://orbit.kiwi/wp-content/uploads/2018/08/orbit-components@2x.png 2x"
36 lines (31 loc) • 965 B
JavaScript
// @flow
import * as React from "react";
import { shallow } from "enzyme";
import Badge from "../index";
import Sightseeing from "../../icons/Sightseeing";
describe("Badge", () => {
const content = "badge";
const type = "info";
const circled = true;
const dataTest = "test";
const icon = <Sightseeing />;
const component = shallow(
<Badge type={type} icon={icon} circled={circled} dataTest={dataTest}>
{content}
</Badge>,
);
it("should have passed props", () => {
expect(component.prop("type")).toBe(type);
expect(component.prop("circled")).toBe(circled);
expect(component.render().prop("data-test")).toBe(dataTest);
});
it("should contain a content", () => {
expect(component.render().text()).toBe(content);
});
it("should contain a icon", () => {
expect(component.find("Sightseeing").exists()).toBe(true);
});
it("should match snapshot", () => {
expect(component).toMatchSnapshot();
});
});