mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-09 16:40:07 -04:00
Update sky.de.test.js
This commit is contained in:
parent
57b1fc56f4
commit
532e2bdd4a
1 changed files with 46 additions and 34 deletions
|
@ -1,4 +1,6 @@
|
|||
const { parser, url } = require('./sky.de.config.js')
|
||||
// npx epg-grabber --config=sites/sky.de/sky.de.config.js --channels=sites/sky.de/sky.de_de.channels.xml --output=guide.xml --days=2
|
||||
|
||||
const { parser, url, request } = require('./sky.de.config.js')
|
||||
const dayjs = require('dayjs')
|
||||
const utc = require('dayjs/plugin/utc')
|
||||
dayjs.extend(utc)
|
||||
|
@ -11,45 +13,55 @@ const channel = {
|
|||
|
||||
const content = `{"cl":[{"ci":522,"el":[{"ei":122309300,"bsdt":1645916700000,"bst":"00:05","bedt":1645918200000,"len":25,"et":"King of Queens","ec":"Comedyserie","cop":"USA","yop":2001,"fsk":"ab 0 Jahre","epit":"Der Experte","sn":"4","en":"11","pu":"/static/img/program_guide/1522936_s.jpg"},{"ei":122309301,"bsdt":1645918200000,"bst":"00:30","bedt":1645919700000,"len":25,"et":"King of Queens","ec":"Comedyserie","cop":"USA","yop":2001,"fsk":"ab 0 Jahre","epit":"Speedy Gonzales","sn":"4","en":"12","pu":"/static/img/program_guide/1522937_s.jpg"}]}]}`
|
||||
|
||||
|
||||
it('can generate valid url', () => {
|
||||
expect(url).toBe('https://www.sky.de/sgtvg/service/getBroadcastsForGrid')
|
||||
expect(url).toBe('https://www.sky.de/sgtvg/service/getBroadcastsForGrid')
|
||||
})
|
||||
|
||||
it('can generate valid request method', () => {
|
||||
expect(request.method).toBe('POST')
|
||||
})
|
||||
|
||||
it('can generate valid request data', () => {
|
||||
expect(request.data({ channel, date })).toMatchObject({
|
||||
cil: [channel.site_id],
|
||||
d: date.valueOf()
|
||||
})
|
||||
})
|
||||
|
||||
it('can parse response', () => {
|
||||
const result = parser({ content, channel }).map(p => {
|
||||
p.start = p.start.toJSON()
|
||||
p.stop = p.stop.toJSON()
|
||||
return p
|
||||
})
|
||||
const result = parser({ content, channel }).map(p => {
|
||||
p.start = p.start.toJSON()
|
||||
p.stop = p.stop.toJSON()
|
||||
return p
|
||||
})
|
||||
|
||||
expect(result).toMatchObject([
|
||||
{
|
||||
title: 'King of Queens',
|
||||
description: 'Der Experte',
|
||||
category: 'Comedyserie',
|
||||
start: '2022-02-26T23:05:00.000Z',
|
||||
stop: '2022-02-26T23:30:00.000Z',
|
||||
season: '4',
|
||||
episode: '11',
|
||||
icon: 'http://sky.de/static/img/program_guide/1522936_s.jpg'
|
||||
},
|
||||
{
|
||||
title: 'King of Queens',
|
||||
description: 'Speedy Gonzales',
|
||||
category: 'Comedyserie',
|
||||
start: '2022-02-26T23:30:00.000Z',
|
||||
stop: '2022-02-26T23:55:00.000Z',
|
||||
season: '4',
|
||||
episode: '12',
|
||||
icon: 'http://sky.de/static/img/program_guide/1522937_s.jpg'
|
||||
}
|
||||
])
|
||||
expect(result).toMatchObject([
|
||||
{
|
||||
title: 'King of Queens',
|
||||
description: 'Der Experte',
|
||||
category: 'Comedyserie',
|
||||
start: '2022-02-26T23:05:00.000Z',
|
||||
stop: '2022-02-26T23:30:00.000Z',
|
||||
season: '4',
|
||||
episode: '11',
|
||||
icon: 'http://sky.de/static/img/program_guide/1522936_s.jpg'
|
||||
},
|
||||
{
|
||||
title: 'King of Queens',
|
||||
description: 'Speedy Gonzales',
|
||||
category: 'Comedyserie',
|
||||
start: '2022-02-26T23:30:00.000Z',
|
||||
stop: '2022-02-26T23:55:00.000Z',
|
||||
season: '4',
|
||||
episode: '12',
|
||||
icon: 'http://sky.de/static/img/program_guide/1522937_s.jpg'
|
||||
}
|
||||
])
|
||||
})
|
||||
|
||||
it('can handle empty guide', () => {
|
||||
const result = parser({
|
||||
content: `[]`
|
||||
})
|
||||
expect(result).toMatchObject([])
|
||||
const result = parser({
|
||||
content: `[]`
|
||||
})
|
||||
expect(result).toMatchObject([])
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue