const { parser, url } = require('./startimestv.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('2022-04-10', 'YYYY-MM-DD').startOf('d') const channel = { site_id: '1023102509', xmltv_id: 'ZeeOneAfrica.za' } it('can generate valid url', () => { expect(url({ channel, date })).toBe( 'https://www.startimestv.com/channeldetail/1023102509/2022-04-10.html' ) }) it('can parse response', () => { const content = '

Guddan S2 E77

00:00-01:00

Vickrant is overjoyed to see Akshat in pain and not knowing what to do.

00:00-01:00 Guddan S2 E77

Vickrant is overjoyed to see Akshat in pain and not knowing what to do.

' const result = parser({ content, date }).map(p => { p.start = p.start.toJSON() p.stop = p.stop.toJSON() return p }) expect(result).toMatchObject([ { start: '2022-04-10T00:00:00.000Z', stop: '2022-04-10T01:00:00.000Z', title: 'Guddan S2 E77', season: 2, episode: 77, description: 'Vickrant is overjoyed to see Akshat in pain and not knowing what to do.' } ]) }) it('can handle empty guide', () => { const result = parser({ content: '

Rate:

Category:


' }) expect(result).toMatchObject([]) })