components_application_panel-ManifestIconItem.test.js (1387B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 // Import libs 7 const { shallow } = require("enzyme"); 8 const { createFactory } = require("react"); 9 10 const ManifestIconItem = createFactory( 11 require("resource://devtools/client/application/src/components/manifest/ManifestIconItem.js") 12 ); 13 14 /* 15 * Unit tests for the ManifestIconItem component 16 */ 17 18 describe("ManifestIconItem", () => { 19 it("renders the expected snapshot for a fully populated icon item", () => { 20 const wrapper = shallow( 21 ManifestIconItem({ 22 label: { sizes: "128x128", contentType: "image/png" }, 23 value: { src: "icon.png", purpose: "any" }, 24 }) 25 ); 26 expect(wrapper).toMatchSnapshot(); 27 }); 28 29 it("renders the expected snapshop when a label member is missing", () => { 30 const wrapper = shallow( 31 ManifestIconItem({ 32 label: { sizes: undefined, contentType: "image/png" }, 33 value: { src: "icon.png", purpose: "any" }, 34 }) 35 ); 36 expect(wrapper).toMatchSnapshot(); 37 }); 38 39 it("renders the expected snapshop when all label members are missing", () => { 40 const wrapper = shallow( 41 ManifestIconItem({ 42 label: { sizes: undefined, contentType: undefined }, 43 value: { src: "icon.png", purpose: "any" }, 44 }) 45 ); 46 expect(wrapper).toMatchSnapshot(); 47 }); 48 });