generated from Seekra/repository-template
Add settings validator unit test #113
@@ -66,13 +66,13 @@ 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 (entry.type === 'selection') {
|
||||||
validateSelectionOptions(entry.options, path);
|
validateSelectionOptions(entry.options, path);
|
||||||
if (typeof entry.allowMultiple !== 'boolean' && entry.allowMultiple) {
|
if (typeof entry.allowMultiple !== 'boolean' && entry.allowMultiple) {
|
||||||
throw new Error(`[settings] "${path}.allowMultiple" must be a boolean`);
|
throw new Error(`[settings] "${path}.allowMultiple" must be a boolean`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user