tor-browser

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

components_application_panel-ManifestPage.test.js (1791B)


      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 {
     11  setupStore,
     12 } = require("resource://devtools/client/application/test/node/helpers.js");
     13 const {
     14  MANIFEST_SIMPLE,
     15 } = require("resource://devtools/client/application/test/node/fixtures/data/constants.js");
     16 
     17 const ManifestPage = createFactory(
     18  require("resource://devtools/client/application/src/components/manifest/ManifestPage.js")
     19 );
     20 
     21 /**
     22 * Test for ManifestPage.js component
     23 */
     24 
     25 describe("ManifestPage", () => {
     26  function buildStoreWithManifest(manifest, isLoading = false) {
     27    return setupStore({
     28      manifest: {
     29        manifest,
     30        errorMessage: "",
     31        isLoading,
     32      },
     33    });
     34  }
     35 
     36  it("renders the expected snapshot when there is a manifest", () => {
     37    const store = buildStoreWithManifest(MANIFEST_SIMPLE);
     38    const wrapper = shallow(ManifestPage({ store })).dive();
     39    expect(wrapper).toMatchSnapshot();
     40  });
     41 
     42  it("renders the expected snapshot when the manifest needs to load", () => {
     43    const store = buildStoreWithManifest(undefined);
     44    const wrapper = shallow(ManifestPage({ store })).dive();
     45    expect(wrapper).toMatchSnapshot();
     46  });
     47 
     48  it("renders the expected snapshot when the manifest is loading", () => {
     49    const store = buildStoreWithManifest(undefined, true);
     50    const wrapper = shallow(ManifestPage({ store })).dive();
     51    expect(wrapper).toMatchSnapshot();
     52  });
     53 
     54  it("renders the expected snapshot when there is no manifest", () => {
     55    const store = buildStoreWithManifest(null);
     56    const wrapper = shallow(ManifestPage({ store })).dive();
     57    expect(wrapper).toMatchSnapshot();
     58  });
     59 });