Update grab.test.ts

This commit is contained in:
freearhey
2026-05-18 20:47:31 +03:00
parent 52ca0dbd15
commit 5777259f83
+25
View File
@@ -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'