diff --git a/sites/gatotv.com/gatotv.com.test.js b/sites/gatotv.com/gatotv.com.test.js
index 8a439a53..e0ac41dc 100644
--- a/sites/gatotv.com/gatotv.com.test.js
+++ b/sites/gatotv.com/gatotv.com.test.js
@@ -1,72 +1,62 @@
-// 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=guide.xml --days=2
+// npm run channels:parse -- --config=./sites/gatotv.com/gatotv.com.config.js --output=./sites/gatotv.com/gatotv.com.channels.xml
+// npx epg-grabber --config=sites/gatotv.com/gatotv.com.config.js --channels=sites/gatotv.com/gatotv.com.channels.xml --output=guide.xml --days=2
const { parser, url, request } = require('./gatotv.com.config.js')
+const fs = require('fs')
+const path = require('path')
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 date = dayjs.utc('2023-01-31', 'YYYY-MM-DD').startOf('d')
const channel = {
- site_id: '13_de_argentina',
- xmltv_id: 'ElTrece.ar'
+ site_id: 'punto_2_puerto_rico',
+ xmltv_id: 'WKAQDT2.us'
}
-const content = `
Horarios de Programación Hora Inicio Hora Fin Programa Madrugada 23:00
00:30
00:30
01:45
01:45
03:30
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.
13:30
13:41
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.
23:55
04:00
`
it('can generate valid url', () => {
- expect(url({ channel, date })).toBe('https://www.gatotv.com/canal/13_de_argentina/2021-11-13')
+ expect(url({ channel, date })).toBe('https://www.gatotv.com/canal/punto_2_puerto_rico/2023-01-31')
})
it('can parse response', () => {
- const result = parser({ date, channel, content }).map(p => {
+ const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.html'), 'utf8')
+ const results = parser({ date, channel, content }).map(p => {
p.start = p.start.toJSON()
p.stop = p.stop.toJSON()
return p
})
- expect(result).toMatchObject([
- {
- start: '2021-11-13T04:00:00.000Z',
- stop: '2021-11-13T05:30:00.000Z',
- title: 'Bienvenidos a bordo'
- },
- {
- start: '2021-11-13T05:30:00.000Z',
- stop: '2021-11-13T06:45:00.000Z',
- title: 'Ciudad de sombras'
- },
- {
- start: '2021-11-13T06:45:00.000Z',
- stop: '2021-11-13T08: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-13T18:30:00.000Z',
- stop: '2021-11-13T18: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-14T04:55:00.000Z',
- stop: '2021-11-14T09:00:00.000Z',
- title: 'Decisión 2021'
- }
- ])
+ expect(results[0]).toMatchObject({
+ start: '2023-01-31T04:30:00.000Z',
+ stop: '2023-01-31T05:30:00.000Z',
+ title: 'Decisiones de mujeres'
+ })
+
+ expect(results[2]).toMatchObject({
+ start: '2023-01-31T06:30:00.000Z',
+ stop: '2023-01-31T07:30:00.000Z',
+ title: 'El Señor de los Cielos',
+ icon: 'https://imagenes.gatotv.com/categorias/telenovelas/miniatura/el_senor_de_los_cielos.jpg',
+ description:
+ 'La vida de Amado Carrillo Fuentes, conocido como “El Señor de los Cielos”, uno de los cabecillas del Cuartel de Juárez.'
+ })
+
+ expect(results[33]).toMatchObject({
+ start: '2023-02-01T04:30:00.000Z',
+ stop: '2023-02-01T05:30:00.000Z',
+ title: 'Decisiones de mujeres'
+ })
})
it('can handle empty guide', () => {
- const result = parser({
+ const results = parser({
date,
channel,
- content: ``
+ content: fs.readFileSync(path.resolve(__dirname, '__data__/no_content.html'), 'utf8')
})
- expect(result).toMatchObject([])
+
+ expect(results).toMatchObject([])
})