// npx epg-grabber --config=sites/mi.tv/mi.tv.config.js --channels=sites/mi.tv/mi.tv_ar.channels.xml --output=.gh-pages/guides/ar/mi.tv.epg.xml --days=2 const { parser, url } = require('./mi.tv.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-24', 'YYYY-MM-DD').startOf('d') const channel = { site_id: 'ar#24-7-canal-de-noticias', xmltv_id: '247CanaldeNoticias.ar' } const content = `
Programación 24/7 Canal de Noticias

Programación 24/7 Canal de Noticias Miércoles 24 de noviembre

` it('can generate valid url', () => { expect(url({ channel, date })).toBe( 'https://mi.tv/ar/async/channel/24-7-canal-de-noticias/2021-11-24/0' ) }) it('can parse response', () => { const result = parser({ content, date }).map(p => { p.start = p.start.toJSON() p.stop = p.stop.toJSON() return p }) expect(result).toMatchObject([ { start: '2021-11-24T03:00:00.000Z', stop: '2021-11-24T23:00:00.000Z', title: `Trasnoche de 24/7`, category: 'Interés general', description: 'Lo más visto de la semana en nuestra pantalla.', icon: 'https://cdn.mitvstatic.com/programs/fallback_other_l_m.jpg' }, { start: '2021-11-24T23:00:00.000Z', stop: '2021-11-25T01:00:00.000Z', title: `Noticiero central - Segunda edición`, category: 'Noticiero', description: `Cerramos el día con un completo resumen de los temas más relevantes con columnistas y análisis especiales para terminar el día.`, icon: 'https://cdn.mitvstatic.com/programs/fallback_other_l_m.jpg' }, { start: '2021-11-25T01:00:00.000Z', stop: '2021-11-25T02:00:00.000Z', title: `Plus energético`, category: 'Cultural', description: `La energía tiene mucho para mostrar. Este programa reúne a las principales empresas y protagonistas de la actividad que esta revolucionando la región.`, icon: 'https://cdn.mitvstatic.com/programs/fallback_other_l_m.jpg' } ]) }) it('can handle empty guide', () => { const result = parser({ date, channel, content: `` }) expect(result).toMatchObject([]) })