Source code
Revision control
Copy as Markdown
Other Tools
Test Info: Warnings
- This test gets skipped with pattern: os == 'android'
- Manifest: browser/components/enterprisepolicies/tests/xpcshell/xpcshell.toml
/* Any copyright is dedicated to the Public Domain.
"use strict";
function checkArrayIsSorted(array, msg) {
let sorted = true;
let sortedArray = array.slice().sort(function (a, b) {
return a.localeCompare(b);
});
for (let i = 0; i < array.length; i++) {
if (array[i] != sortedArray[i]) {
sorted = false;
break;
}
}
ok(sorted, msg);
}
add_task(async function test_policies_sorted() {
let { schema } = ChromeUtils.importESModule(
"resource:///modules/policies/schema.sys.mjs"
);
let { Policies } = ChromeUtils.importESModule(
"resource:///modules/policies/Policies.sys.mjs"
);
checkArrayIsSorted(
Object.keys(schema.properties),
"policies-schema.json is alphabetically sorted."
);
checkArrayIsSorted(
Object.keys(Policies),
"Policies.sys.mjs is alphabetically sorted."
);
});
add_task(async function check_naming_conventions() {
let { schema } = ChromeUtils.importESModule(
"resource:///modules/policies/schema.sys.mjs"
);
equal(
Object.keys(schema.properties).some(key => key.includes("__")),
false,
"Can't use __ in a policy name as it's used as a delimiter"
);
});