Add settings validator unit test #113

Merged
jakob.scheid merged 20 commits from testing/settings-validator into main 2026-06-04 17:48:09 +02:00
Showing only changes of commit 775e206322 - Show all commits
@@ -72,6 +72,14 @@ export const validateEntry = function validateEntry (entry, path) {
if (entry.type === 'string' && typeof entry.default !== 'string') { if (entry.type === 'string' && typeof entry.default !== 'string') {
throw new Error(`[settings] "${path}.default" must be a string`); throw new Error(`[settings] "${path}.default" must be a string`);
} }
if (entry.type === 'selection') {
if (typeof entry.default !== 'string') {
throw new Error(`[settings] "${path}.default" must be a string`);
};
if (!entry.options.map((option) => option.name).includes(entry.default)) {
throw new Error(`[settings] option "${path}.default" does not exist`);
};
};
} }
} }