UNPKG

@hackoregon/component-library

Version:

Official repo for Hack Oregon React component library

18 lines 727 B
import React from "react"; import { shallow } from "enzyme"; import ChartTitle from "./ChartTitle"; describe("ChartTitle", function () { it("should render a title and subtitle when provided", function () { var wrapper = shallow(React.createElement(ChartTitle, { title: "Fun title", subtitle: "Fun subtitle" })); expect(wrapper.find("h2").text()).to.eql("Fun title"); expect(wrapper.find("h3").text()).to.eql("Fun subtitle"); }); it("should neither render a title nor a subtitle when neither are provided", function () { var wrapper = shallow(React.createElement(ChartTitle, null)); expect(wrapper.find("h2").length).to.eql(0); expect(wrapper.find("h3").length).to.eql(0); }); });