diff --git a/sites/beinsports.com/beinsports.com.test.js b/sites/beinsports.com/beinsports.com.test.js new file mode 100644 index 00000000..97be8e6d --- /dev/null +++ b/sites/beinsports.com/beinsports.com.test.js @@ -0,0 +1,93 @@ +// npx epg-grabber --config=sites/beinsports.com/beinsports.com.config.js --channels=sites/beinsports.com/beinsports.com_qa.channels.xml --days=2 --output=.gh-pages/guides/qa/beinsports.com.epg.xml + +const { parser, url, logo } = require('./beinsports.com.config.js') +const dayjs = require('dayjs') +const utc = require('dayjs/plugin/utc') +const customParseFormat = require('dayjs/plugin/customParseFormat') +dayjs.extend(customParseFormat) +dayjs.extend(utc) + +const date = dayjs.utc('2021-10-24', 'YYYY-MM-DD').startOf('d') +const channel = { site_id: '1', xmltv_id: 'BeInSports.qa' } +const content = ` +
+
+
+
+
+
+
+
+
+
    +
    +
    +
    +
    +
    Live Events
    +
    +
    + +
    +
    +
    +
    +
    +
    +
    + +
    +
    +
    +
    +
    +
    • +
      +

      Red Bull Car Park Drift 2021

      +

      MotorSports

      +
      +

      21:45 - 00:40

      +
      70% Complete
    • + +
    +
    +
    +
    + +
    +
    +
    +
    +
    +
    +` + +it('can generate valid url', () => { + const result = url({ date }) + expect(result).toBe( + 'https://epg.beinsports.com/utctime.php?mins=00&serviceidentity=beinsports.com&cdate=2021-10-24' + ) +}) + +it('can get logo url', () => { + const result = logo({ content, channel }) + expect(result).toBe( + 'https://assets.bein.com/mena/sites/3/2015/06/bein_SPORTS_FTA_DIGITAL_Mono.png' + ) +}) + +it('can parse response', () => { + const result = parser({ date, channel, content }) + expect(result).toMatchObject([ + { + start: 'Sat, 23 Oct 2021 21:45:00 GMT', + stop: 'Sun, 24 Oct 2021 00:40:00 GMT', + title: 'Red Bull Car Park Drift 2021', + category: 'MotorSports' + } + ]) +})