mirror of
https://github.com/samsonjs/mit-license.git
synced 2026-04-04 11:05:48 +00:00
Update tests and remove offending file
This commit is contained in:
parent
1e01e834ef
commit
1d65967dfc
2 changed files with 20 additions and 23 deletions
35
test.js
35
test.js
|
|
@ -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`)
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
}
|
||||
Loading…
Reference in a new issue