mirror of
https://github.com/iptv-org/iptv
synced 2026-09-06 12:01:57 -04:00
Update validate.test.ts
This commit is contained in:
@@ -12,7 +12,9 @@ describe('playlist:validate', () => {
|
||||
it('show an error if channel id in the blocklist', () => {
|
||||
const cmd = `${ENV_VAR} npm run playlist:validate -- us_blocked.m3u`
|
||||
try {
|
||||
execSync(cmd, { encoding: 'utf8' })
|
||||
const stdout = execSync(cmd, { encoding: 'utf8' })
|
||||
if (process.env.DEBUG === 'true') console.log(cmd, stdout)
|
||||
process.exit(0)
|
||||
} catch (error) {
|
||||
if (process.env.DEBUG === 'true') console.log(cmd, error)
|
||||
expect((error as ExecError).stdout).toContain('us_blocked.m3u')
|
||||
@@ -26,22 +28,64 @@ describe('playlist:validate', () => {
|
||||
}
|
||||
})
|
||||
|
||||
it('show a warning if channel has wrong id', () => {
|
||||
const cmd = `${ENV_VAR} npm run playlist:validate -- wrong_id.m3u`
|
||||
it('show a warning if stream is missing a channel id', () => {
|
||||
const cmd = `${ENV_VAR} npm run playlist:validate -- missing_channel_id.m3u`
|
||||
try {
|
||||
execSync(cmd, { encoding: 'utf8' })
|
||||
const stdout = execSync(cmd, { encoding: 'utf8' })
|
||||
if (process.env.DEBUG === 'true') console.log(cmd, stdout)
|
||||
expect(stdout).toContain(
|
||||
'missing_channel_id.m3u\n 2 warning "https://example.com/playlist2.m3u8" is missing a channel ID\n\n1 problems (0 errors, 1 warnings)\n'
|
||||
)
|
||||
} catch (error) {
|
||||
if (process.env.DEBUG === 'true') console.log(cmd, error)
|
||||
expect((error as ExecError).stdout).toContain(
|
||||
'wrong_id.m3u\n 2 warning "qib22lAq1L.us" is not in the database\n\n1 problems (0 errors, 1 warnings)\n'
|
||||
}
|
||||
})
|
||||
|
||||
it('show a warning if stream has wrong channel id', () => {
|
||||
const cmd = `${ENV_VAR} npm run playlist:validate -- wrong_channel_id.m3u`
|
||||
try {
|
||||
const stdout = execSync(cmd, { encoding: 'utf8' })
|
||||
if (process.env.DEBUG === 'true') console.log(cmd, stdout)
|
||||
expect(stdout).toContain(
|
||||
'wrong_channel_id.m3u\n 2 warning "qib22lAq1L.us" is not in the database\n\n1 problems (0 errors, 1 warnings)\n'
|
||||
)
|
||||
} catch (error) {
|
||||
if (process.env.DEBUG === 'true') console.log(cmd, error)
|
||||
}
|
||||
})
|
||||
|
||||
it('show a warning if stream is missing a feed id', () => {
|
||||
const cmd = `${ENV_VAR} npm run playlist:validate -- missing_feed_id.m3u`
|
||||
try {
|
||||
const stdout = execSync(cmd, { encoding: 'utf8' })
|
||||
if (process.env.DEBUG === 'true') console.log(cmd, stdout)
|
||||
expect(stdout).toContain(
|
||||
'missing_feed_id.m3u\n 2 warning "https://example.com/playlist2.m3u8" is missing a feed ID\n\n1 problems (0 errors, 1 warnings)\n'
|
||||
)
|
||||
} catch (error) {
|
||||
if (process.env.DEBUG === 'true') console.log(cmd, error)
|
||||
}
|
||||
})
|
||||
|
||||
it('show a warning if stream has a wrong feed id', () => {
|
||||
const cmd = `${ENV_VAR} npm run playlist:validate -- wrong_feed_id.m3u`
|
||||
try {
|
||||
const stdout = execSync(cmd, { encoding: 'utf8' })
|
||||
if (process.env.DEBUG === 'true') console.log(cmd, stdout)
|
||||
expect(stdout).toContain(
|
||||
'wrong_feed_id.m3u\n 2 warning There is no feed with the ID "HD" in the database for the "Channel7.bz" channel\n\n1 problems (0 errors, 1 warnings)\n'
|
||||
)
|
||||
} catch (error) {
|
||||
if (process.env.DEBUG === 'true') console.log(cmd, error)
|
||||
}
|
||||
})
|
||||
|
||||
it('show a error if stream has an invalid url', () => {
|
||||
const cmd = `${ENV_VAR} npm run playlist:validate -- invalid_url.m3u`
|
||||
try {
|
||||
execSync(cmd, { encoding: 'utf8' })
|
||||
const stdout = execSync(cmd, { encoding: 'utf8' })
|
||||
if (process.env.DEBUG === 'true') console.log(cmd, stdout)
|
||||
process.exit(0)
|
||||
} catch (error) {
|
||||
if (process.env.DEBUG === 'true') console.log(cmd, error)
|
||||
expect((error as ExecError).stdout).toContain('invalid_url.m3u')
|
||||
@@ -54,6 +98,7 @@ describe('playlist:validate', () => {
|
||||
|
||||
it('skip the file if it does not exist', () => {
|
||||
const cmd = `${ENV_VAR} npm run playlist:validate -- missing.m3u`
|
||||
execSync(cmd, { encoding: 'utf8' })
|
||||
const stdout = execSync(cmd, { encoding: 'utf8' })
|
||||
if (process.env.DEBUG === 'true') console.log(cmd, stdout)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user