const { parser, url } = require('./vtm.be.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-11-10', 'YYYY-MM-DD').startOf('d') const channel = { site_id: 'vtm', xmltv_id: 'VTM.be' } const content = ` ` it('can generate valid url', () => { const result = url({ channel }) expect(result).toBe('https://vtm.be/tv-gids/vtm') }) it('can parse response', () => { const result = parser({ date, channel, content }) expect(result).toMatchObject([ { start: '2021-11-10T23:45:00.000Z', stop: '2021-11-11T00:20:00.000Z', title: 'Wooninspiraties', image: 'https://images4.persgroep.net/rcs/z5qrZHumkjuN5rWzoaRJ_BTdL7A/diocontent/209688322/_fill/600/400?appId=da11c75db9b73ea0f41f0cd0da631c71', description: 'Een team gaat op pad om inspiratie op te doen over alles wat met wonen en leven te maken heeft; Ze trekken heel het land door om de laatste trends en tips op het gebied van wonen te achterhalen.', category: 'Magazine' } ]) }) it('can handle empty guide', () => { const result = parser({ date, channel, content: ' ' }) expect(result).toMatchObject([]) })