UNPKG

@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"

25 lines (21 loc) 761 B
// @flow import * as React from "react"; import { shallow } from "enzyme"; import CountryFlag from "../index"; import { CODES } from "../consts"; const code = CODES.ANYWHERE; const name = "Anywhere"; const dataTest = "test"; describe(`CountryFlag of ${name}`, () => { const component = shallow(<CountryFlag code={code} name={name} dataTest={dataTest} />); it("should have passed props", () => { expect(component.prop("src")).toContain(code); expect(component.prop("srcSet")).toContain(code); expect(component.prop("alt")).toBe(name); expect(component.prop("title")).toBe(name); expect(component.render().prop("data-test")).toBe(dataTest); }); it("should match snapshot", () => { expect(component).toMatchSnapshot(); }); });