Update validate.js

This commit is contained in:
Aleksandr Statciuk 2022-04-09 15:58:52 +03:00
parent f92d80b236
commit 9f925606bd

View file

@ -68,6 +68,7 @@ async function main() {
fileErrors = fileErrors.concat(await validateChannelCategories(row, i))
fileErrors = fileErrors.concat(await validateChannelLanguages(row, i))
fileErrors = fileErrors.concat(await validateChannelCountry(row, i))
fileErrors = fileErrors.concat(await validateChannelSubdivision(row, i))
}
} else if (filename === 'blocklist') {
for (const [i, row] of rows.entries()) {
@ -147,6 +148,18 @@ async function validateChannelCountry(row, i) {
return errors
}
async function validateChannelSubdivision(row, i) {
const errors = []
if (row.subdivision && !db.subdivisions[row.subdivision]) {
errors.push({
line: i + 2,
message: `"${row.id}" has the wrong subdivision "${row.subdivision}"`
})
}
return errors
}
async function validateChannelLanguages(row, i) {
const errors = []
row.languages.forEach(language => {