mirror of
https://github.com/iptv-org/database.git
synced 2024-11-09 22:16:38 -05:00
Merge branch 'master' of https://github.com/AntiPontifex/database
This commit is contained in:
commit
7aa78e976b
4 changed files with 180 additions and 163 deletions
File diff suppressed because it is too large
Load diff
|
@ -23,12 +23,11 @@ async function main() {
|
|||
if (file.extension() !== 'csv') continue
|
||||
|
||||
const csv = await dataStorage.load(file.basename())
|
||||
if (/\s+$/.test(csv))
|
||||
return handleError(`Error: empty lines at the end of file not allowed (${filepath})`)
|
||||
|
||||
const rows = csv.split(/\r\n/)
|
||||
const headers = rows[0].split(',')
|
||||
for (const [i, line] of rows.entries()) {
|
||||
if (!line.trim()) continue
|
||||
if (line.indexOf('\n') > -1)
|
||||
return handleError(
|
||||
`Error: row ${i + 1} has the wrong line ending character, should be CRLF (${filepath})`
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
id,name,alt_names,network,owners,country,subdivision,city,broadcast_area,languages,categories,is_nsfw,launched,closed,replaced_by,website,logo
|
||||
PeoplesWeather.do,People°s Weather,,,,DO,,,c/DO,spa,,FALSE,,,,,https://i.imgur.com/7oNe8xj.png
|
||||
KSTVKids.ua,¡KS TV | Kids,,,,UA,,,c/UA,ukr,,FALSE,,,,,https://i.imgur.com/CmRfj78.png
|
||||
KSTVKids.ua,¡KS TV | Kids,,,,UA,,,c/UA,ukr,,FALSE,,,,,https://i.imgur.com/CmRfj78.png
|
||||
|
|
|
|
@ -6,20 +6,6 @@ type ExecError = {
|
|||
}
|
||||
|
||||
describe('db:validate', () => {
|
||||
it('shows an error if there is an empty line at the end of the file', () => {
|
||||
try {
|
||||
execSync('DATA_DIR=tests/__data__/input/validate/empty_line npm run db:validate', {
|
||||
encoding: 'utf8'
|
||||
})
|
||||
process.exit(1)
|
||||
} catch (error) {
|
||||
expect((error as ExecError).status).toBe(1)
|
||||
expect((error as ExecError).stdout).toContain(
|
||||
'Error: empty lines at the end of file not allowed (channels.csv)'
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
it('shows an error if the number of columns in a row is incorrect', () => {
|
||||
try {
|
||||
execSync('DATA_DIR=tests/__data__/input/validate/wrong_num_cols npm run db:validate', {
|
||||
|
|
Loading…
Reference in a new issue