import { HelpText } from "content-src/aboutwelcome/components/HelpText"; import { Localized } from "content-src/aboutwelcome/components/MSLocalized"; import React from "react"; import { shallow } from "enzyme"; describe("", () => { it("should render text inside Localized", () => { const shallowWrapper = shallow(); assert.equal(shallowWrapper.find(Localized).props().text, "test"); }); it("should render the img if there is an img and a string_id", () => { const shallowWrapper = shallow( ); assert.ok( shallowWrapper .find(Localized) .findWhere(n => n.text.string_id === "test_id") ); assert.lengthOf(shallowWrapper.find("p.helptext"), 1); assert.lengthOf(shallowWrapper.find("img[data-l10n-name='help-img']"), 1); }); it("should render the img if there is an img and plain text", () => { const shallowWrapper = shallow( ); assert.equal(shallowWrapper.find("p.helptext").text(), "Sample help text"); assert.lengthOf(shallowWrapper.find("img.helptext-img"), 1); }); });