diff --git a/sites/vtm.be/vtm.be.test.js b/sites/vtm.be/vtm.be.test.js new file mode 100644 index 00000000..2603a441 --- /dev/null +++ b/sites/vtm.be/vtm.be.test.js @@ -0,0 +1,50 @@ +// npx epg-grabber --config=sites/vtm.be/vtm.be.config.js --channels=sites/vtm.be/vtm.be_be.channels.xml --output=.gh-pages/guides/be/vtm.be.epg.xml --days=2 + +const { parser, url, logo } = 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 get logo url', () => { + expect(logo({ content, channel })).toBe( + 'https://images4.persgroep.net/rcs/-JpJ692wUcyJ14N20YNDKhK3JEU/diocontent/175372657/_fitwidth/500?appId=da11c75db9b73ea0f41f0cd0da631c71' + ) +}) + +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', + icon: '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([]) +})