summaryrefslogtreecommitdiffstats
path: root/devtools/client/application/test/node/components/manifest/components_application_panel-ManifestJsonLink.test.js
blob: fccab31b9d1a9244ec3619bbf200fcdabab5d8b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/* Any copyright is dedicated to the Public Domain.
   http://creativecommons.org/publicdomain/zero/1.0/ */

"use strict";

// Import libs
const { shallow } = require("enzyme");
const { createFactory } = require("react");

const ManifestJsonLink = createFactory(
  require("resource://devtools/client/application/src/components/manifest/ManifestJsonLink.js")
);

/*
 * Test for the ManifestJsonLink component
 */

describe("ManifestJsonLink", () => {
  it("renders the expected snapshot when given a regular URL", () => {
    const wrapper = shallow(
      ManifestJsonLink({ url: "https://example.com/manifest.json" })
    );
    expect(wrapper).toMatchSnapshot();
  });

  it("renders the expected snapshot when given a data URL", () => {
    const wrapper = shallow(
      ManifestJsonLink({
        url: `data:application/manifest+json,{"name": "Foo"}`,
      })
    );
    expect(wrapper).toMatchSnapshot();
    // assert there's no link for data URLs
    expect(wrapper.find("a").length).toBe(0);
  });
});