mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-11 01:20:08 -04:00
Create telkku.com.test.js
This commit is contained in:
parent
861649f412
commit
08430551c0
1 changed files with 49 additions and 0 deletions
49
sites/telkku.com/telkku.com.test.js
Normal file
49
sites/telkku.com/telkku.com.test.js
Normal file
|
@ -0,0 +1,49 @@
|
|||
// npm run channels:parse -- --config=./sites/telkku.com/telkku.com.config.js --output=./sites/telkku.com/telkku.com_fi.channels.xml
|
||||
// npx epg-grabber --config=sites/telkku.com/telkku.com.config.js --channels=sites/telkku.com/telkku.com_fi.channels.xml --output=guide.xml --days=2
|
||||
|
||||
const { parser, url } = require('./telkku.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('2022-10-29', 'YYYY-MM-DD').startOf('d')
|
||||
const channel = {
|
||||
site_id: 'default_builtin_channelgroup1#yle-tv1',
|
||||
xmltv_id: 'YleTV1.fi'
|
||||
}
|
||||
|
||||
it('can generate valid url', () => {
|
||||
expect(url({ channel, date })).toBe(
|
||||
'https://telkku.com/api/channel-groups/default_builtin_channelgroup1/offering?startTime=00%3A00%3A00.000&duration=PT24H&inclusionPolicy=IncludeOngoingAlso&limit=1000&tvDate=2022-10-29&view=PublicationDetails'
|
||||
)
|
||||
})
|
||||
|
||||
it('can parse response', () => {
|
||||
const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.json'))
|
||||
const results = parser({ content, channel }).map(p => {
|
||||
p.start = p.start.toJSON()
|
||||
p.stop = p.stop.toJSON()
|
||||
return p
|
||||
})
|
||||
|
||||
expect(results[0]).toMatchObject({
|
||||
start: '2022-10-28T20:50:00.000Z',
|
||||
stop: '2022-10-28T21:20:00.000Z',
|
||||
title: 'Puoli seitsemän',
|
||||
description:
|
||||
'Vieraana näyttelijä Elias Salonen. Puoli seiskassa vietetään sekä halloweeniä että joulua, kun Olli-Pekka tapaa todellisen jouluttajan. Juontajina Anniina Valtonen, Tuulianna Tola ja Olli-Pekka Kursi.',
|
||||
icon: 'https://thumbor.prod.telkku.com/YTglotoUl7aJtzPtYnvM9tH03sY=/1200x630/smart/filters:quality(86):format(jpeg)/img.prod.telkku.com/program-images/0f885238ac16ce167a9d80eace450254.jpg'
|
||||
})
|
||||
})
|
||||
|
||||
it('can handle empty guide', () => {
|
||||
const result = parser({
|
||||
content: fs.readFileSync(path.resolve(__dirname, '__data__/no-content.json')),
|
||||
channel
|
||||
})
|
||||
expect(result).toMatchObject([])
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue