mirror of
https://github.com/iptv-org/epg
synced 2026-04-28 05:26:59 -04:00
Update tests
This commit is contained in:
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version='1.0' encoding="UTF-8"?>
|
||||||
|
<channels>
|
||||||
|
<channel site="singlequotes.com" lang="en" xmltv_id="" site_id="140">Bravo 2</channel>
|
||||||
|
</channels>
|
||||||
4
tests/__data__/input/channels-lint/valid.channels.xml
Normal file
4
tests/__data__/input/channels-lint/valid.channels.xml
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<channels>
|
||||||
|
<channel site="valid.com" lang="en" xmltv_id="BravoEast.us" site_id="140#Tes't">Bravo's</channel>
|
||||||
|
</channels>
|
||||||
@@ -53,4 +53,31 @@ describe('channels:lint', () => {
|
|||||||
expect((error as ExecError).stdout).toContain('2 error(s)')
|
expect((error as ExecError).stdout).toContain('2 error(s)')
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('will show a message if the file contains single quotes', () => {
|
||||||
|
try {
|
||||||
|
const cmd =
|
||||||
|
'npm run channels:lint --- tests/__data__/input/channels-lint/single_quotes.channels.xml'
|
||||||
|
const stdout = execSync(cmd, { encoding: 'utf8' })
|
||||||
|
if (process.env.DEBUG === 'true') console.log(cmd, stdout)
|
||||||
|
process.exit(1)
|
||||||
|
} catch (error) {
|
||||||
|
expect((error as ExecError).status).toBe(1)
|
||||||
|
expect((error as ExecError).stdout).toContain('single_quotes.channels.xml')
|
||||||
|
expect((error as ExecError).stdout).toContain(
|
||||||
|
'1:14 Single quotes cannot be used in attributes'
|
||||||
|
)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
it('does not display errors if there are none', () => {
|
||||||
|
try {
|
||||||
|
const cmd = 'npm run channels:lint --- tests/__data__/input/channels-lint/valid.channels.xml'
|
||||||
|
const stdout = execSync(cmd, { encoding: 'utf8' })
|
||||||
|
if (process.env.DEBUG === 'true') console.log(cmd, stdout)
|
||||||
|
} catch (error) {
|
||||||
|
if (process.env.DEBUG === 'true') console.log((error as ExecError).stdout)
|
||||||
|
process.exit(1)
|
||||||
|
}
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user