mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 00:50:09 -04:00
Add "debug" mode to tests
This commit is contained in:
parent
ae7b32b079
commit
c8055f10d6
7 changed files with 31 additions and 27 deletions
|
@ -25,7 +25,8 @@ describe('channels:editor', () => {
|
|||
|
||||
try {
|
||||
const cmd = `${ENV_VAR} npm run channels:editor --- tests/__data__/output/channels.xml`
|
||||
execSync(cmd, { encoding: 'utf8' })
|
||||
const stdout = execSync(cmd, { encoding: 'utf8' })
|
||||
if (process.env.DEBUG === 'true') console.log(stdout)
|
||||
} catch (error) {
|
||||
expect((error as ExecError).status).toBe(1)
|
||||
expect((error as ExecError).stdout).toContain('CNN International | CNNInternational.us [new]')
|
||||
|
|
|
@ -9,7 +9,8 @@ describe('channels:lint', () => {
|
|||
it('will show a message if the file contains a syntax error', () => {
|
||||
try {
|
||||
const cmd = 'npm run channels:lint --- tests/__data__/input/channels-lint/error.channels.xml'
|
||||
execSync(cmd, { encoding: 'utf8' })
|
||||
const stdout = execSync(cmd, { encoding: 'utf8' })
|
||||
if (process.env.DEBUG === 'true') console.log(stdout)
|
||||
process.exit(1)
|
||||
} catch (error) {
|
||||
expect((error as ExecError).status).toBe(1)
|
||||
|
@ -23,7 +24,8 @@ describe('channels:lint', () => {
|
|||
try {
|
||||
const cmd =
|
||||
'npm run channels:lint --- tests/__data__/input/channels-lint/invalid.channels.xml'
|
||||
execSync(cmd, { encoding: 'utf8' })
|
||||
const stdout = execSync(cmd, { encoding: 'utf8' })
|
||||
if (process.env.DEBUG === 'true') console.log(stdout)
|
||||
process.exit(1)
|
||||
} catch (error) {
|
||||
expect((error as ExecError).status).toBe(1)
|
||||
|
@ -37,7 +39,8 @@ describe('channels:lint', () => {
|
|||
try {
|
||||
const cmd =
|
||||
'npm run channels:lint --- tests/__data__/input/channels-lint/error.channels.xml tests/__data__/input/channels-lint/invalid.channels.xml'
|
||||
execSync(cmd, { encoding: 'utf8' })
|
||||
const stdout = execSync(cmd, { encoding: 'utf8' })
|
||||
if (process.env.DEBUG === 'true') console.log(stdout)
|
||||
process.exit(1)
|
||||
} catch (error) {
|
||||
expect((error as ExecError).status).toBe(1)
|
||||
|
|
|
@ -14,7 +14,8 @@ describe('channels:parse', () => {
|
|||
it('can parse channels', () => {
|
||||
const cmd =
|
||||
'npm run channels:parse --- --config=tests/__data__/input/channels-parse/channels-parse.config.js --output=tests/__data__/output/channels.xml'
|
||||
execSync(cmd, { encoding: 'utf8' })
|
||||
const stdout = execSync(cmd, { encoding: 'utf8' })
|
||||
if (process.env.DEBUG === 'true') console.log(stdout)
|
||||
|
||||
expect(content('tests/__data__/output/channels.xml')).toEqual(
|
||||
content('tests/__data__/expected/sites/channels-parse/channels-parse.channels.xml')
|
||||
|
|
|
@ -15,17 +15,12 @@ describe('channels:validate', () => {
|
|||
it('will show a message if the file contains a duplicate', () => {
|
||||
try {
|
||||
const cmd = `${ENV_VAR} npm run channels:validate --- --channels=tests/__data__/input/channels-validate/duplicate.channels.xml`
|
||||
execSync(cmd, { encoding: 'utf8' })
|
||||
const stdout = execSync(cmd, { encoding: 'utf8' })
|
||||
if (process.env.DEBUG === 'true') console.log(stdout)
|
||||
process.exit(1)
|
||||
} catch (error) {
|
||||
expect((error as ExecError).status).toBe(1)
|
||||
expect((error as ExecError).stdout).toContain(`
|
||||
> channels:validate
|
||||
> npx tsx scripts/commands/channels/validate.ts --channels=tests/__data__/input/channels-validate/duplicate.channels.xml
|
||||
|
||||
options:
|
||||
channels: tests/__data__/input/channels-validate/duplicate.channels.xml
|
||||
tests/__data__/input/channels-validate/duplicate.channels.xml
|
||||
┌─────────┬─────────────┬──────┬────────────────┬─────────┬─────────┐
|
||||
│ (index) │ type │ lang │ xmltv_id │ site_id │ name │
|
||||
├─────────┼─────────────┼──────┼────────────────┼─────────┼─────────┤
|
||||
|
@ -40,17 +35,12 @@ tests/__data__/input/channels-validate/duplicate.channels.xml
|
|||
it('will show a message if the file contains a channel with wrong xmltv_id', () => {
|
||||
try {
|
||||
const cmd = `${ENV_VAR} npm run channels:validate --- --channels=tests/__data__/input/channels-validate/wrong_xmltv_id.channels.xml`
|
||||
execSync(cmd, { encoding: 'utf8' })
|
||||
const stdout = execSync(cmd, { encoding: 'utf8' })
|
||||
if (process.env.DEBUG === 'true') console.log(stdout)
|
||||
process.exit(1)
|
||||
} catch (error) {
|
||||
expect((error as ExecError).status).toBe(1)
|
||||
expect((error as ExecError).stdout).toContain(`
|
||||
> channels:validate
|
||||
> npx tsx scripts/commands/channels/validate.ts --channels=tests/__data__/input/channels-validate/wrong_xmltv_id.channels.xml
|
||||
|
||||
options:
|
||||
channels: tests/__data__/input/channels-validate/wrong_xmltv_id.channels.xml
|
||||
tests/__data__/input/channels-validate/wrong_xmltv_id.channels.xml
|
||||
┌─────────┬──────────────────┬──────┬────────────────────┬─────────┬─────────────────────┐
|
||||
│ (index) │ type │ lang │ xmltv_id │ site_id │ name │
|
||||
├─────────┼──────────────────┼──────┼────────────────────┼─────────┼─────────────────────┤
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue