mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-09 16:40:07 -04:00
Update parse.test.js
This commit is contained in:
parent
feddd9500b
commit
f2057dd015
1 changed files with 19 additions and 4 deletions
|
@ -4,19 +4,34 @@ const path = require('path')
|
|||
|
||||
beforeEach(() => {
|
||||
fs.emptyDirSync('tests/__data__/output')
|
||||
|
||||
const stdout = execSync(
|
||||
'npm run channels:parse -- --config=tests/__data__/input/sites/parse-channels.config.js --output=tests/__data__/output/channels.xml',
|
||||
{ encoding: 'utf8' }
|
||||
fs.copySync(
|
||||
'tests/__data__/input/sites/parse-channels.channels.xml',
|
||||
'tests/__data__/output/channels.xml'
|
||||
)
|
||||
})
|
||||
|
||||
it('can parse channels', () => {
|
||||
const stdout = execSync(
|
||||
'npm run channels:parse -- --config=tests/__data__/input/sites/parse-channels.config.js --output=tests/__data__/output/channels.xml',
|
||||
{ encoding: 'utf8' }
|
||||
)
|
||||
|
||||
expect(content('tests/__data__/output/channels.xml')).toEqual(
|
||||
content('tests/__data__/expected/sites/parse-channels.channels.xml')
|
||||
)
|
||||
})
|
||||
|
||||
it('can parse channels with clean flag', () => {
|
||||
const stdout = execSync(
|
||||
'npm run channels:parse -- --config=tests/__data__/input/sites/parse-channels.config.js --output=tests/__data__/output/channels.xml --clean',
|
||||
{ encoding: 'utf8' }
|
||||
)
|
||||
|
||||
expect(content('tests/__data__/output/channels.xml')).toEqual(
|
||||
content('tests/__data__/expected/sites/parse-channels-clean.channels.xml')
|
||||
)
|
||||
})
|
||||
|
||||
function content(filepath) {
|
||||
return fs.readFileSync(path.resolve(filepath), {
|
||||
encoding: 'utf8'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue