test_ui_schemas_valid.js (945B)
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 [ 8 "urlbar-persisted-search-terms-schema.json", 9 "urlbar-persisted-search-terms-ui-schema.json", 10 ], 11 ]; 12 13 async function checkUISchemaValid(configSchema, uiSchema) { 14 for (let key of Object.keys(configSchema.properties)) { 15 Assert.ok( 16 uiSchema["ui:order"].includes(key), 17 `Should have ${key} listed at the top-level of the ui schema` 18 ); 19 } 20 } 21 22 add_task(async function test_ui_schemas_valid() { 23 for (let [schema, uiSchema] of schemas) { 24 info(`Validating ${uiSchema} has every top-level from ${schema}`); 25 let schemaData = await IOUtils.readJSON( 26 PathUtils.join(do_get_cwd().path, schema) 27 ); 28 let uiSchemaData = await IOUtils.readJSON( 29 PathUtils.join(do_get_cwd().path, uiSchema) 30 ); 31 32 await checkUISchemaValid(schemaData, uiSchemaData); 33 } 34 });