mirror of
https://github.com/web3privacy/explorer-data.git
synced 2024-10-15 12:06:26 +02:00
test: validate all project enums
This commit is contained in:
parent
ad201b69f4
commit
ec7f7769a6
1 changed files with 5 additions and 2 deletions
|
@ -61,6 +61,9 @@ const schemas = await loadSchemas();
|
|||
schemas.rank.properties.references.items.properties.field.enum = getDeepPropertiesKeys(schemas.project);
|
||||
schemas.project.properties.categories.items.enum = w3pd.data.categories.map((c) => c.id);
|
||||
schemas.project.properties.usecases.items.enum = w3pd.data.usecases.map((c) => c.id);
|
||||
schemas.project.properties.technology.properties.features.items.enum = w3pd.data.features.map((f) => f.id);
|
||||
schemas.project.properties.ecosystem.enum = w3pd.data.ecosystems.map((e) => e.id);
|
||||
schemas.project.properties.assets_used.items.enum = w3pd.data.assets.map((a) => a.id);
|
||||
|
||||
for (const col of Object.keys(w3pd.data)) {
|
||||
const validator = ajv.compile(schemas[matrix[col]]);
|
||||
|
@ -88,8 +91,8 @@ for (const col of Object.keys(w3pd.data)) {
|
|||
Deno.test(testName + " (schema)", () => {
|
||||
if (!validator(item)) {
|
||||
const betterErrors = betterAjvErrors({ errors: validator.errors });
|
||||
// throw betterErrors;
|
||||
console.log(betterErrors);
|
||||
throw betterErrors;
|
||||
// console.log(betterErrors);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue