tor-browser

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

test_ui_schemas_valid.js (900B)


      1 /* Any copyright is dedicated to the Public Domain.
      2   http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 "use strict";
      5 
      6 let schemas = [
      7  ["search-telemetry-v2-schema.json", "search-telemetry-v2-ui-schema.json"],
      8 ];
      9 
     10 function checkUISchemaValid(configSchema, uiSchema) {
     11  for (let key of Object.keys(configSchema.properties)) {
     12    Assert.ok(
     13      uiSchema["ui:order"].includes(key),
     14      `Should have ${key} listed at the top-level of the ui schema`
     15    );
     16  }
     17 }
     18 
     19 add_task(async function test_ui_schemas_valid() {
     20  for (let [schema, uiSchema] of schemas) {
     21    info(`Validating ${uiSchema} has every top-level from ${schema}`);
     22    let schemaData = await IOUtils.readJSON(
     23      PathUtils.join(do_get_cwd().path, schema)
     24    );
     25    let uiSchemaData = await IOUtils.readJSON(
     26      PathUtils.join(do_get_cwd().path, uiSchema)
     27    );
     28 
     29    checkUISchemaValid(schemaData, uiSchemaData);
     30  }
     31 });