summaryrefslogtreecommitdiffstats
path: root/toolkit/components/search/tests/xpcshell/searchconfigs/test_searchconfig_ui_schemas_valid.js
blob: 3315bf974f8ffd8944243f8b0d0dde055d3cb556 (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";

let schemas = [
  ["search-config-schema.json", "search-config-ui-schema.json"],
  ["search-config-v2-schema.json", "search-config-v2-ui-schema.json"],
  ["search-config-icons-schema.json", "search-config-icons-ui-schema.json"],
  [
    "search-config-overrides-schema.json",
    "search-config-overrides-ui-schema.json",
  ],
  [
    "search-config-overrides-v2-schema.json",
    "search-config-overrides-v2-ui-schema.json",
  ],
  [
    "search-default-override-allowlist-schema.json",
    "search-default-override-allowlist-ui-schema.json",
  ],
];

add_task(async function test_ui_schemas_valid() {
  for (let [schema, uiSchema] of schemas) {
    info(`Validating ${uiSchema} has every top-level from ${schema}`);
    let schemaData = await IOUtils.readJSON(
      PathUtils.join(do_get_cwd().path, schema)
    );
    let uiSchemaData = await IOUtils.readJSON(
      PathUtils.join(do_get_cwd().path, uiSchema)
    );

    await checkUISchemaValid(schemaData, uiSchemaData);
  }
});