Update turksatkablo.com.tr.test.js

This commit is contained in:
Aleksandr Statciuk 2021-11-25 00:57:25 +03:00
parent c4dc1f504c
commit 4724e9a3a8

View file

@ -1,4 +1,4 @@
// npx epg-grabber --config=sites/turksatkablo.com.tr/turksatkablo.com.tr.config.js --channels=sites/turksatkablo.com.tr/turksatkablo.com.tr_tr.channels.xml --days=2 --output=.gh-pages/guides/tr/turksatkablo.com.tr.epg.xml // npx epg-grabber --config=sites/turksatkablo.com.tr/turksatkablo.com.tr.config.js --channels=sites/turksatkablo.com.tr/turksatkablo.com.tr_tr.channels.xml --output=.gh-pages/guides/tr/turksatkablo.com.tr.epg.xml --days=2
const { parser, url } = require('./turksatkablo.com.tr.config.js') const { parser, url } = require('./turksatkablo.com.tr.config.js')
const dayjs = require('dayjs') const dayjs = require('dayjs')
@ -17,15 +17,35 @@ it('can generate valid url', () => {
}) })
it('can parse response', () => { it('can parse response', () => {
const result = parser({ date, channel, content }) const result = parser({ date, channel, content }).map(p => {
expect(result[0]).toMatchObject({ p.start = p.start.toJSON()
start: 'Sun, 24 Oct 2021 22:15:00 GMT', p.stop = p.stop.toJSON()
stop: 'Mon, 25 Oct 2021 00:00:00 GMT', return p
})
expect(result).toMatchObject([
{
start: '2021-10-24T22:15:00.000Z',
stop: '2021-10-25T00:00:00.000Z',
title: 'Ölüm Ormanı' title: 'Ölüm Ormanı'
}) },
expect(result[2]).toMatchObject({ {
start: 'Mon, 25 Oct 2021 20:45:00 GMT', start: '2021-10-25T12:00:00.000Z',
stop: 'Tue, 26 Oct 2021 00:45:00 GMT', stop: '2021-10-25T14:00:00.000Z',
title: 'Kızım'
},
{
start: '2021-10-25T20:45:00.000Z',
stop: '2021-10-26T00:45:00.000Z',
title: 'Kaçakçı' title: 'Kaçakçı'
}
])
}) })
it('can handle empty guide', () => {
const result = parser({
date,
channel,
content: `<!DOCTYPE html><html><head></head><body></body></html>`
})
expect(result).toMatchObject([])
}) })