summaryrefslogtreecommitdiffstats
path: root/devtools/client/application/test/node/components/service-workers/components_application_panel-RegistrationList.test.js
blob: 6bb202cd2597e672724ea04f758d0c6f5e859964 (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
37
38
39
40
41
42
43
/* 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");

// Import constants
const {
  SINGLE_WORKER_DEFAULT_DOMAIN_LIST,
  MULTIPLE_WORKER_LIST,
} = require("resource://devtools/client/application/test/node/fixtures/data/constants.js");

const RegistrationList = createFactory(
  require("resource://devtools/client/application/src/components/service-workers/RegistrationList.js")
);

/**
 * Test for RegistrationList.js component
 */
describe("RegistrationList", () => {
  it("renders the expected snapshot for a list with a single registration", () => {
    const wrapper = shallow(
      RegistrationList({
        registrations: SINGLE_WORKER_DEFAULT_DOMAIN_LIST,
        canDebugWorkers: true,
      })
    );
    expect(wrapper).toMatchSnapshot();
  });

  it("renders the expected snapshot for a multiple registration list", () => {
    const wrapper = shallow(
      RegistrationList({
        registrations: MULTIPLE_WORKER_LIST,
        canDebugWorkers: true,
      })
    );
    expect(wrapper).toMatchSnapshot();
  });
});