mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 00:50:09 -04:00
Update grab.test.ts
This commit is contained in:
parent
d2fa9a0e0f
commit
b3a9224a51
1 changed files with 6 additions and 4 deletions
|
@ -2,6 +2,7 @@ import { execSync } from 'child_process'
|
||||||
import fs from 'fs-extra'
|
import fs from 'fs-extra'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
import os from 'os'
|
import os from 'os'
|
||||||
|
import { Zip } from '@freearhey/core'
|
||||||
|
|
||||||
let ENV_VAR =
|
let ENV_VAR =
|
||||||
'SITES_DIR=tests/__data__/input/epg-grab/sites CURR_DATE=2022-10-20 DATA_DIR=tests/__data__/input/temp/data'
|
'SITES_DIR=tests/__data__/input/epg-grab/sites CURR_DATE=2022-10-20 DATA_DIR=tests/__data__/input/temp/data'
|
||||||
|
@ -33,7 +34,7 @@ describe('epg:grab', () => {
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('can grab epg with gzip option enabled', () => {
|
it('can grab epg with gzip option enabled', async () => {
|
||||||
const cmd = `${ENV_VAR} npm run grab -- --channels=tests/__data__/input/epg-grab/sites/**/*.channels.xml --output=tests/__data__/output/guide.xml --gzip`
|
const cmd = `${ENV_VAR} npm run grab -- --channels=tests/__data__/input/epg-grab/sites/**/*.channels.xml --output=tests/__data__/output/guide.xml --gzip`
|
||||||
execSync(cmd, { encoding: 'utf8' })
|
execSync(cmd, { encoding: 'utf8' })
|
||||||
|
|
||||||
|
@ -41,9 +42,10 @@ describe('epg:grab', () => {
|
||||||
content('tests/__data__/expected/guide.xml')
|
content('tests/__data__/expected/guide.xml')
|
||||||
)
|
)
|
||||||
|
|
||||||
expect(fs.readFileSync('tests/__data__/output/guide.xml.gz')).toEqual(
|
const zip = new Zip()
|
||||||
fs.readFileSync('tests/__data__/expected/guide.xml.gz')
|
const expected = await zip.decompress(fs.readFileSync('tests/__data__/output/guide.xml.gz'))
|
||||||
)
|
const result = await zip.decompress(fs.readFileSync('tests/__data__/expected/guide.xml.gz'))
|
||||||
|
expect(expected).toEqual(result)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('can grab epg with wildcard as output', () => {
|
it('can grab epg with wildcard as output', () => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue