Update beinsports.com.test.js

This commit is contained in:
Aleksandr Statciuk 2022-05-08 18:17:05 +03:00
parent cb0a179bc2
commit 79ead4c40d

View file

@ -1,4 +1,6 @@
// npm run channels:parse -- --config=./sites/beinsports.com/beinsports.com.config.js --output=./sites/beinsports.com/beinsports.com_qa-ar.channels.xml --set=lang:ar --set=region:ar
// npx epg-grabber --config=sites/beinsports.com/beinsports.com.config.js --channels=sites/beinsports.com/beinsports.com_qa-en.channels.xml --output=guide.xml --timeout=30000 --days=2 // npx epg-grabber --config=sites/beinsports.com/beinsports.com.config.js --channels=sites/beinsports.com/beinsports.com_qa-en.channels.xml --output=guide.xml --timeout=30000 --days=2
// npx epg-grabber --config=sites/beinsports.com/beinsports.com.config.js --channels=sites/beinsports.com/beinsports.com_qa-ar.channels.xml --output=guide.xml --timeout=30000 --days=2
const { parser, url } = require('./beinsports.com.config.js') const { parser, url } = require('./beinsports.com.config.js')
const fs = require('fs') const fs = require('fs')
@ -13,12 +15,20 @@ const date = dayjs.utc('2022-05-08', 'YYYY-MM-DD').startOf('d')
const channel = { site_id: '#1', xmltv_id: 'BeINSports.qa' } const channel = { site_id: '#1', xmltv_id: 'BeINSports.qa' }
it('can generate valid url', () => { it('can generate valid url', () => {
const result = url({ date }) const result = url({ date, channel })
expect(result).toBe( expect(result).toBe(
'https://epg.beinsports.com/utctime.php?mins=00&serviceidentity=beinsports.com&cdate=2022-05-08' 'https://epg.beinsports.com/utctime.php?mins=00&serviceidentity=beinsports.com&cdate=2022-05-08'
) )
}) })
it('can generate valid url for arabic guide', () => {
const channel = { site_id: 'ar#1', xmltv_id: 'BeINSports.qa' }
const result = url({ date, channel })
expect(result).toBe(
'https://epg.beinsports.com/utctime_ar.php?mins=00&serviceidentity=beinsports.com&cdate=2022-05-08'
)
})
it('can parse response', () => { it('can parse response', () => {
const content = fs.readFileSync(path.resolve('sites/beinsports.com/__data__/content.html')) const content = fs.readFileSync(path.resolve('sites/beinsports.com/__data__/content.html'))
const results = parser({ date, channel, content }).map(p => { const results = parser({ date, channel, content }).map(p => {