From 82959a531f3c1cb86c27eeaba1b9375e6865ec94 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Mon, 15 Nov 2021 21:59:00 +0300 Subject: [PATCH] Create gatotv.com.test.js --- sites/gatotv.com/gatotv.com.test.js | 78 +++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 sites/gatotv.com/gatotv.com.test.js diff --git a/sites/gatotv.com/gatotv.com.test.js b/sites/gatotv.com/gatotv.com.test.js new file mode 100644 index 00000000..8c0c571b --- /dev/null +++ b/sites/gatotv.com/gatotv.com.test.js @@ -0,0 +1,78 @@ +// node ./scripts/channels.js --config=./sites/gatotv.com/gatotv.com.config.js --output=./sites/gatotv.com/gatotv.com_cr.channels.xml --set=country:costa_rica +// npx epg-grabber --config=sites/gatotv.com/gatotv.com.config.js --channels=sites/gatotv.com/gatotv.com_ar.channels.xml --output=.gh-pages/guides/ar/gatotv.com.epg.xml --days=2 + +const { parser, url, request, logo } = require('./gatotv.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-11-13', 'YYYY-MM-DD').startOf('d') +const channel = { + site_id: '13_de_argentina', + xmltv_id: 'ElTrece.ar' +} +const content = `

Horarios de Programación

Hora Inicio Hora Fin Programa
Madrugada
Bienvenidos a bordo
Ciudad de sombras
Cuando un ex rescatista de rehenes del FBI evalúa la seguridad de un rascacielos en China, un incendio repentino hace que sea acusado injustamente.
Robin, Starfire, Raven, Chico Bestia y Cyborg se preparan para nuevas aventuras cómicas después de hacer un sándwich, jugar algún videojuego o lavar la ropa.
Decisión 2021
Disponibilidad
DirecTV Latinoamérica DirecTV Latinoamérica Canal 124
` + +it('can generate valid url', () => { + expect(url({ channel, date })).toBe('https://www.gatotv.com/canal/13_de_argentina/2021-11-13') +}) + +it('can get logo url', () => { + expect(logo({ content })).toBe( + 'https://imagenes.gatotv.com/logos/canales/oscuros/13_de_argentina-mediano.png' + ) +}) + +it('can parse response', () => { + const result = parser({ date, channel, content }).map(p => { + p.start = p.start.toJSON() + p.stop = p.stop.toJSON() + + return p + }) + + expect(result).toMatchObject([ + { + start: '2021-11-13T02:00:00.000Z', + stop: '2021-11-13T03:30:00.000Z', + title: 'Bienvenidos a bordo' + }, + { + start: '2021-11-13T03:30:00.000Z', + stop: '2021-11-13T04:45:00.000Z', + title: 'Ciudad de sombras' + }, + { + start: '2021-11-13T04:45:00.000Z', + stop: '2021-11-13T06:30:00.000Z', + title: 'Rascacielos: Rescate en las Alturas', + icon: 'https://imagenes.gatotv.com/categorias/peliculas/miniatura/rascacielos.jpg', + description: + 'Cuando un ex rescatista de rehenes del FBI evalúa la seguridad de un rascacielos en China, un incendio repentino hace que sea acusado injustamente.' + }, + { + start: '2021-11-13T16:30:00.000Z', + stop: '2021-11-13T16:41:00.000Z', + title: 'Los Jóvenes Titanes En Acción', + icon: 'https://imagenes.gatotv.com/categorias/caricaturas/miniatura/los_jovenes_titanes_en_accion.jpg', + description: + 'Robin, Starfire, Raven, Chico Bestia y Cyborg se preparan para nuevas aventuras cómicas después de hacer un sándwich, jugar algún videojuego o lavar la ropa.' + }, + { + start: '2021-11-14T02:55:00.000Z', + stop: '2021-11-14T07:00:00.000Z', + title: 'Decisión 2021' + } + ]) +}) + +it('can handle empty guide', () => { + const result = parser({ + date, + channel, + content: `` + }) + expect(result).toMatchObject([]) +})