tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

components_application_panel-ManifestJsonLink.test.js (1013B)


      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 ManifestJsonLink = createFactory(
     11  require("resource://devtools/client/application/src/components/manifest/ManifestJsonLink.js")
     12 );
     13 
     14 /*
     15 * Test for the ManifestJsonLink component
     16 */
     17 
     18 describe("ManifestJsonLink", () => {
     19  it("renders the expected snapshot when given a regular URL", () => {
     20    const wrapper = shallow(
     21      ManifestJsonLink({ url: "https://example.com/manifest.json" })
     22    );
     23    expect(wrapper).toMatchSnapshot();
     24  });
     25 
     26  it("renders the expected snapshot when given a data URL", () => {
     27    const wrapper = shallow(
     28      ManifestJsonLink({
     29        url: `data:application/manifest+json,{"name": "Foo"}`,
     30      })
     31    );
     32    expect(wrapper).toMatchSnapshot();
     33    // assert there's no link for data URLs
     34    expect(wrapper.find("a").length).toBe(0);
     35  });
     36 });