Bug 1878834 - Rename search-telemetry-schema to include v2 and add ui schema tests. r=scunnane
Depends on D205250 Differential Revision: https://phabricator.services.mozilla.com/D205341
This commit is contained in:
@@ -386,7 +386,7 @@ class TelemetryHandler {
|
|||||||
* unit tests can set it to easy to test values.
|
* unit tests can set it to easy to test values.
|
||||||
*
|
*
|
||||||
* @param {Array} providerInfo
|
* @param {Array} providerInfo
|
||||||
* See {@link https://searchfox.org/mozilla-central/search?q=search-telemetry-schema.json}
|
* See {@link https://searchfox.org/mozilla-central/search?q=search-telemetry-v2-schema.json}
|
||||||
* for type information.
|
* for type information.
|
||||||
*/
|
*/
|
||||||
overrideSearchTelemetryForTests(providerInfo) {
|
overrideSearchTelemetryForTests(providerInfo) {
|
||||||
|
|||||||
@@ -11,10 +11,12 @@
|
|||||||
"organicCodes",
|
"organicCodes",
|
||||||
"followOnParamNames",
|
"followOnParamNames",
|
||||||
"followOnCookies",
|
"followOnCookies",
|
||||||
|
"ignoreLinkRegexps",
|
||||||
"extraAdServersRegexps",
|
"extraAdServersRegexps",
|
||||||
"adServerAttributes",
|
"adServerAttributes",
|
||||||
"components",
|
"components",
|
||||||
"nonAdsLinkRegexps",
|
"nonAdsLinkRegexps",
|
||||||
|
"nonAdsLinkQueryParamNames",
|
||||||
"shoppingTab",
|
"shoppingTab",
|
||||||
"domainExtraction",
|
"domainExtraction",
|
||||||
"isSPA",
|
"isSPA",
|
||||||
@@ -57,7 +57,7 @@ function disallowAdditionalProperties(section) {
|
|||||||
|
|
||||||
add_task(async function test_search_telemetry_validates_to_schema() {
|
add_task(async function test_search_telemetry_validates_to_schema() {
|
||||||
let schema = await IOUtils.readJSON(
|
let schema = await IOUtils.readJSON(
|
||||||
PathUtils.join(do_get_cwd().path, "search-telemetry-schema.json")
|
PathUtils.join(do_get_cwd().path, "search-telemetry-v2-schema.json")
|
||||||
);
|
);
|
||||||
disallowAdditionalProperties(schema);
|
disallowAdditionalProperties(schema);
|
||||||
|
|
||||||
|
|||||||
31
browser/components/search/test/unit/test_ui_schemas_valid.js
Normal file
31
browser/components/search/test/unit/test_ui_schemas_valid.js
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
/* Any copyright is dedicated to the Public Domain.
|
||||||
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||||
|
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
let schemas = [
|
||||||
|
["search-telemetry-v2-schema.json", "search-telemetry-v2-ui-schema.json"],
|
||||||
|
];
|
||||||
|
|
||||||
|
async function checkUISchemaValid(configSchema, uiSchema) {
|
||||||
|
for (let key of Object.keys(configSchema.properties)) {
|
||||||
|
Assert.ok(
|
||||||
|
uiSchema["ui:order"].includes(key),
|
||||||
|
`Should have ${key} listed at the top-level of the ui schema`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
});
|
||||||
@@ -14,7 +14,13 @@ prefs = ["browser.search.serpEventTelemetryCategorization.enabled=true"]
|
|||||||
["test_search_telemetry_compare_urls.js"]
|
["test_search_telemetry_compare_urls.js"]
|
||||||
|
|
||||||
["test_search_telemetry_config_validation.js"]
|
["test_search_telemetry_config_validation.js"]
|
||||||
support-files = ["../../schema/search-telemetry-schema.json"]
|
support-files = ["../../schema/search-telemetry-v2-schema.json"]
|
||||||
|
|
||||||
|
["test_ui_schemas_valid.js"]
|
||||||
|
support-files = [
|
||||||
|
"../../schema/search-telemetry-v2-schema.json",
|
||||||
|
"../../schema/search-telemetry-v2-ui-schema.json",
|
||||||
|
]
|
||||||
|
|
||||||
["test_urlTelemetry.js"]
|
["test_urlTelemetry.js"]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user