summaryrefslogtreecommitdiffstats
path: root/devtools/client/inspector/compatibility/test/xpcshell/test_default-browsers.js
blob: c565e77d016b872900bd4e514f202b30fab77110 (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
/* Any copyright is dedicated to the Public Domain.
   http://creativecommons.org/publicdomain/zero/1.0/ */
"use strict";

// Test for the default browsers of user settings.

const {
  getBrowsersList,
} = require("resource://devtools/shared/compatibility/compatibility-user-settings.js");

add_task(async () => {
  info("Check whether each default browsers data are unique by id and status");

  const defaultBrowsers = await getBrowsersList();

  for (const target of defaultBrowsers) {
    const count = defaultBrowsers.reduce(
      (currentCount, browser) =>
        target.id === browser.id && target.status === browser.status
          ? currentCount + 1
          : currentCount,
      0
    );

    equal(count, 1, `This browser (${target.id} - ${target.status}) is unique`);
  }
});