mirror of
https://github.com/iptv-org/epg
synced 2026-07-03 13:47:11 -04:00
Update grab.test.ts
This commit is contained in:
@@ -113,6 +113,31 @@ describe('epg:grab', () => {
|
||||
expect(output).toEqual(expected)
|
||||
})
|
||||
|
||||
it('can grab epg with GZIP environment variable', () => {
|
||||
const cmd = `${ENV_VAR} GZIP=true npm run grab --- --channels=tests/__data__/input/epg_grab/sites/example2.com/example2.com.channels.xml --output="${path.resolve(
|
||||
'tests/__data__/output/guides/guide.xml'
|
||||
)}"`
|
||||
const stdout = execSync(cmd, { encoding: 'utf8' })
|
||||
if (process.env.DEBUG === 'true') console.log(cmd, stdout)
|
||||
|
||||
expect(content('tests/__data__/output/guides/guide.xml')).toEqual(
|
||||
content('tests/__data__/expected/epg_grab/gzip/guide.xml')
|
||||
)
|
||||
|
||||
const outputString = pako.ungzip(fs.readFileSync('tests/__data__/output/guides/guide.xml.gz'), {
|
||||
to: 'string'
|
||||
})
|
||||
const expectedString = pako.ungzip(
|
||||
fs.readFileSync('tests/__data__/expected/epg_grab/gzip/guide.xml.gz'),
|
||||
{ to: 'string' }
|
||||
)
|
||||
|
||||
const output = new Set(outputString.split('\r\n'))
|
||||
const expected = new Set(expectedString.split('\r\n'))
|
||||
|
||||
expect(output).toEqual(expected)
|
||||
})
|
||||
|
||||
it('can grab epg with gzip option enabled', () => {
|
||||
const cmd = `${ENV_VAR} npm run grab --- --channels=tests/__data__/input/epg_grab/sites/example2.com/example2.com.channels.xml --output="${path.resolve(
|
||||
'tests/__data__/output/guides/guide.xml'
|
||||
|
||||
Reference in New Issue
Block a user