Update tests and remove offending file

This commit is contained in:
Richie Bendall 2019-06-02 18:15:57 +12:00
parent 1e01e834ef
commit 1d65967dfc
No known key found for this signature in database
GPG key ID: 1C6A99DFA9D306FC
2 changed files with 20 additions and 23 deletions

35
test.js
View file

@ -8,23 +8,28 @@ let errored = false
const users = fs.readdirSync('users')
users.forEach(async (user) => {
if (user.endsWith('json')) {
fs.readFile(path.join('users', user), 'utf8', async (err, content) => {
if (err) {
errored = true
console.error(`Unable to read ${user}`)
} else {
try {
const u = JSON.parse(content)
if (!u.locked && !u.copyright) {
errored = true
console.error(`Copyright not specified in ${user} (${e})`)
}
} catch (e) {
if (encodeURIComponent(user) === user) {
fs.readFile(path.join('users', user), 'utf8', async (err, content) => {
if (err) {
errored = true
console.error(`Invalid JSON in ${user} (${e})`)
console.error(`Unable to read ${user}`)
} else {
try {
const u = JSON.parse(content)
if (!u.locked && !u.copyright) {
errored = true
console.error(`Copyright not specified in ${user} (${e})`)
}
} catch (e) {
errored = true
console.error(`Invalid JSON in ${user} (${e})`)
}
}
}
})
})
} else {
errored = true
console.error(`${user} is not URL safe`)
}
} else {
errored = true
console.error(`${user} is not a json file`)

View file

@ -1,8 +0,0 @@
{
"copyright": "Omid Gharib, https://github.com/omidgharib",
"url": "http://omidgharib.ir",
"format": "txt",
"email": "omidgharib@yahoo.com",
"gravatar": true,
"theme": "default"
}