mirror of
https://github.com/iptv-org/epg
synced 2026-05-07 01:46:59 -04:00
uniformise tests part 1
This commit is contained in:
File diff suppressed because one or more lines are too long
1
sites/tv.yandex.ru/__data__/no_content.html
Normal file
1
sites/tv.yandex.ru/__data__/no_content.html
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<!DOCTYPE html><html><head></head><body></body></html>
|
||||||
@@ -86,7 +86,7 @@ it('can handle empty guide', async () => {
|
|||||||
const result = await parser({
|
const result = await parser({
|
||||||
date,
|
date,
|
||||||
channel,
|
channel,
|
||||||
content: '<!DOCTYPE html><html><head></head><body></body></html>'
|
content: fs.readFileSync(path.resolve(__dirname, '__data__', 'no_content.html'), 'utf8')
|
||||||
})
|
})
|
||||||
expect(result).toMatchObject([])
|
expect(result).toMatchObject([])
|
||||||
})
|
})
|
||||||
|
|||||||
54
sites/tv2go.t-2.net/__data__/content.json
Normal file
54
sites/tv2go.t-2.net/__data__/content.json
Normal file
@@ -0,0 +1,54 @@
|
|||||||
|
{
|
||||||
|
"entries":[
|
||||||
|
{
|
||||||
|
"channelId":1000259,
|
||||||
|
"startTimestamp":"1637283000000",
|
||||||
|
"endTimestamp":"1637284500000",
|
||||||
|
"name":"Dnevnik Slovencev v Italiji",
|
||||||
|
"nameSingleLine":"Dnevnik Slovencev v Italiji",
|
||||||
|
"description":"Informativni",
|
||||||
|
"images":[
|
||||||
|
{
|
||||||
|
"url":"/static/media/img/epg/max_crop/EPG_IMG_2927405.jpg",
|
||||||
|
"width":1008,
|
||||||
|
"height":720,
|
||||||
|
"averageColor":[
|
||||||
|
143,
|
||||||
|
147,
|
||||||
|
161
|
||||||
|
]
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"show":{
|
||||||
|
"id":51991133,
|
||||||
|
"title":"Dnevnik Slovencev v Italiji",
|
||||||
|
"originalTitle":"Dnevnik Slovencev v Italiji",
|
||||||
|
"shortDescription":"Dnevnik Slovencev v Italiji je informativna oddaja, v kateri novinarji poročajo predvsem o dnevnih dogodkih med Slovenci v Italiji.",
|
||||||
|
"longDescription":"Pomembno ogledalo vsakdana, v katerem opozarjajo na težave, s katerimi se soočajo, predstavljajo pa tudi pestro kulturno, športno in družbeno življenje slovenske narodne skupnosti. V oddajo so vključene tudi novice iz matične domovine.",
|
||||||
|
"type":{
|
||||||
|
"id":10,
|
||||||
|
"name":"Show"
|
||||||
|
},
|
||||||
|
"productionFrom":"1609502400000",
|
||||||
|
"countries":[
|
||||||
|
{
|
||||||
|
"id":"SI",
|
||||||
|
"name":"Slovenija"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"languages":[
|
||||||
|
{
|
||||||
|
"languageId":2,
|
||||||
|
"name":"Slovenščina"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"genres":[
|
||||||
|
{
|
||||||
|
"id":1000002,
|
||||||
|
"name":"Informativni"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
const { parser, url, request } = require('./tv2go.t-2.net.config.js')
|
const { parser, url, request } = require('./tv2go.t-2.net.config.js')
|
||||||
const dayjs = require('dayjs')
|
const dayjs = require('dayjs')
|
||||||
|
const fs = require('fs')
|
||||||
|
const path = require('path')
|
||||||
const utc = require('dayjs/plugin/utc')
|
const utc = require('dayjs/plugin/utc')
|
||||||
const customParseFormat = require('dayjs/plugin/customParseFormat')
|
const customParseFormat = require('dayjs/plugin/customParseFormat')
|
||||||
dayjs.extend(customParseFormat)
|
dayjs.extend(customParseFormat)
|
||||||
@@ -36,8 +38,7 @@ it('can generate valid request data', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('can parse response', () => {
|
it('can parse response', () => {
|
||||||
const content =
|
const content = fs.readFileSync(path.join(__dirname, '__data__', 'content.json'), 'utf8')
|
||||||
'{"entries":[{"channelId":1000259,"startTimestamp":"1637283000000","endTimestamp":"1637284500000","name":"Dnevnik Slovencev v Italiji","nameSingleLine":"Dnevnik Slovencev v Italiji","description":"Informativni","images":[{"url":"/static/media/img/epg/max_crop/EPG_IMG_2927405.jpg","width":1008,"height":720,"averageColor":[143,147,161]}],"show":{"id":51991133,"title":"Dnevnik Slovencev v Italiji","originalTitle":"Dnevnik Slovencev v Italiji","shortDescription":"Dnevnik Slovencev v Italiji je informativna oddaja, v kateri novinarji poročajo predvsem o dnevnih dogodkih med Slovenci v Italiji.","longDescription":"Pomembno ogledalo vsakdana, v katerem opozarjajo na težave, s katerimi se soočajo, predstavljajo pa tudi pestro kulturno, športno in družbeno življenje slovenske narodne skupnosti. V oddajo so vključene tudi novice iz matične domovine.","type":{"id":10,"name":"Show"},"productionFrom":"1609502400000","countries":[{"id":"SI","name":"Slovenija"}],"languages":[{"languageId":2,"name":"Slovenščina"}],"genres":[{"id":1000002,"name":"Informativni"}]}}]}'
|
|
||||||
const result = parser({ content, channel }).map(p => {
|
const result = parser({ content, channel }).map(p => {
|
||||||
p.start = p.start.toJSON()
|
p.start = p.start.toJSON()
|
||||||
p.stop = p.stop.toJSON()
|
p.stop = p.stop.toJSON()
|
||||||
|
|||||||
1
sites/tvcesoir.fr/__data__/no_content.html
Normal file
1
sites/tvcesoir.fr/__data__/no_content.html
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<!DOCTYPE html><html><head></head><body></body></html>
|
||||||
@@ -44,7 +44,7 @@ it('can handle empty guide', () => {
|
|||||||
const result = parser({
|
const result = parser({
|
||||||
date,
|
date,
|
||||||
channel,
|
channel,
|
||||||
content: '<!DOCTYPE html><html><head></head><body></body></html>'
|
content: fs.readFileSync(path.resolve(__dirname, './__data__/no_content.html'), 'utf8')
|
||||||
})
|
})
|
||||||
expect(result).toMatchObject([])
|
expect(result).toMatchObject([])
|
||||||
})
|
})
|
||||||
|
|||||||
55
sites/tvcubana.icrt.cu/__data__/content.json
Normal file
55
sites/tvcubana.icrt.cu/__data__/content.json
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"eventId":"6169c2300ad38b0a8d9e3760",
|
||||||
|
"title":"CARIBE NOTICIAS",
|
||||||
|
"description":"EMISI\\u00d3N DE CIERRE.",
|
||||||
|
"eventInitialDate":"2021-11-22T00:00:00",
|
||||||
|
"eventEndDate":"2021-11-22T00:00:00",
|
||||||
|
"idFromEprog":"5c096ea5bad1b202541503cf",
|
||||||
|
"extendedDescription":"",
|
||||||
|
"transmission":"Estreno",
|
||||||
|
"pid":"",
|
||||||
|
"space":"CARIBE NOTICIAS",
|
||||||
|
"eventStartTime":{
|
||||||
|
"value":{
|
||||||
|
"ticks":24000000000,
|
||||||
|
"days":0,
|
||||||
|
"hours":0,
|
||||||
|
"milliseconds":0,
|
||||||
|
"minutes":40,
|
||||||
|
"seconds":0,
|
||||||
|
"totalDays":0.027777777777777776,
|
||||||
|
"totalHours":0.6666666666666666,
|
||||||
|
"totalMilliseconds":2400000,
|
||||||
|
"totalMinutes":40,
|
||||||
|
"totalSeconds":2400
|
||||||
|
},
|
||||||
|
"hasValue":true
|
||||||
|
},
|
||||||
|
"eventEndTime":{
|
||||||
|
"value":{
|
||||||
|
"ticks":30000000000,
|
||||||
|
"days":0,
|
||||||
|
"hours":0,
|
||||||
|
"milliseconds":0,
|
||||||
|
"minutes":50,
|
||||||
|
"seconds":0,
|
||||||
|
"totalDays":0.034722222222222224,
|
||||||
|
"totalHours":0.8333333333333334,
|
||||||
|
"totalMilliseconds":3000000,
|
||||||
|
"totalMinutes":50,
|
||||||
|
"totalSeconds":3000
|
||||||
|
},
|
||||||
|
"hasValue":true
|
||||||
|
},
|
||||||
|
"eventDuration":"00:10:00",
|
||||||
|
"channelName":"Cubavisi\\u00f3n",
|
||||||
|
"eventInitialDateTime":"2021-11-22T00:40:00",
|
||||||
|
"eventEndDateTime":"2021-11-22T00:50:00",
|
||||||
|
"isEventWithNegativeDuration":false,
|
||||||
|
"isEventWithDurationOver24Hrs":false,
|
||||||
|
"isEventWithTextOverLength":false,
|
||||||
|
"created":"2021-11-22T10:32:27.476824",
|
||||||
|
"id":5309687
|
||||||
|
}
|
||||||
|
]
|
||||||
1
sites/tvcubana.icrt.cu/__data__/no_content.html
Normal file
1
sites/tvcubana.icrt.cu/__data__/no_content.html
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<!DOCTYPE html><html lang="es-es" dir="ltr"><head></head><body class="error-page" ></body></html>
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
const { parser, url } = require('./tvcubana.icrt.cu.config.js')
|
const { parser, url } = require('./tvcubana.icrt.cu.config.js')
|
||||||
const dayjs = require('dayjs')
|
const dayjs = require('dayjs')
|
||||||
|
const fs = require('fs')
|
||||||
|
const path = require('path')
|
||||||
const utc = require('dayjs/plugin/utc')
|
const utc = require('dayjs/plugin/utc')
|
||||||
const customParseFormat = require('dayjs/plugin/customParseFormat')
|
const customParseFormat = require('dayjs/plugin/customParseFormat')
|
||||||
dayjs.extend(customParseFormat)
|
dayjs.extend(customParseFormat)
|
||||||
@@ -10,8 +12,9 @@ const channel = {
|
|||||||
site_id: 'cv',
|
site_id: 'cv',
|
||||||
xmltv_id: 'CubavisionNacional.cu'
|
xmltv_id: 'CubavisionNacional.cu'
|
||||||
}
|
}
|
||||||
const content =
|
let content = fs.readFileSync(path.resolve(__dirname, './__data__/content.json'), {encoding: 'utf8'})
|
||||||
'[{"eventId":"6169c2300ad38b0a8d9e3760","title":"CARIBE NOTICIAS","description":"EMISI\\u00d3N DE CIERRE.","eventInitialDate":"2021-11-22T00:00:00","eventEndDate":"2021-11-22T00:00:00","idFromEprog":"5c096ea5bad1b202541503cf","extendedDescription":"","transmission":"Estreno","pid":"","space":"CARIBE NOTICIAS","eventStartTime":{"value":{"ticks":24000000000,"days":0,"hours":0,"milliseconds":0,"minutes":40,"seconds":0,"totalDays":0.027777777777777776,"totalHours":0.6666666666666666,"totalMilliseconds":2400000,"totalMinutes":40,"totalSeconds":2400},"hasValue":true},"eventEndTime":{"value":{"ticks":30000000000,"days":0,"hours":0,"milliseconds":0,"minutes":50,"seconds":0,"totalDays":0.034722222222222224,"totalHours":0.8333333333333334,"totalMilliseconds":3000000,"totalMinutes":50,"totalSeconds":3000},"hasValue":true},"eventDuration":"00:10:00","channelName":"Cubavisi\\u00f3n","eventInitialDateTime":"2021-11-22T00:40:00","eventEndDateTime":"2021-11-22T00:50:00","isEventWithNegativeDuration":false,"isEventWithDurationOver24Hrs":false,"isEventWithTextOverLength":false,"created":"2021-11-22T10:32:27.476824","id":5309687}]'
|
// in the specific case of this site, the unicode escape sequences are double-escaped
|
||||||
|
content = content.replace(/\\\\u([0-9a-fA-F]{4})/g, '\\u$1')
|
||||||
|
|
||||||
it('can generate valid url', () => {
|
it('can generate valid url', () => {
|
||||||
expect(url({ channel, date })).toBe('https://www.tvcubana.icrt.cu/cartv/cv/lunes.php')
|
expect(url({ channel, date })).toBe('https://www.tvcubana.icrt.cu/cartv/cv/lunes.php')
|
||||||
@@ -43,8 +46,7 @@ it('can handle empty guide', () => {
|
|||||||
const result = parser({
|
const result = parser({
|
||||||
date,
|
date,
|
||||||
channel,
|
channel,
|
||||||
content:
|
content: fs.readFileSync(path.resolve(__dirname, './__data__/no_content.html'), 'utf8')
|
||||||
'<!DOCTYPE html><html lang="es-es" dir="ltr"><head></head><body class="error-page" ></body></html>'
|
|
||||||
})
|
})
|
||||||
expect(result).toMatchObject([])
|
expect(result).toMatchObject([])
|
||||||
})
|
})
|
||||||
|
|||||||
34
sites/tvguide.myjcom.jp/__data__/content.json
Normal file
34
sites/tvguide.myjcom.jp/__data__/content.json
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
{
|
||||||
|
"120_200_4_20220114":[
|
||||||
|
{
|
||||||
|
"@search.score":1,
|
||||||
|
"cid":"120_7305523",
|
||||||
|
"serviceCode":"200_4",
|
||||||
|
"channelName":"スターチャンネル1",
|
||||||
|
"digitalNo":195,
|
||||||
|
"eventId":"181",
|
||||||
|
"title":"[5.1]フードロア:タマリンド",
|
||||||
|
"commentary":"HBO(R)アジア製作。日本の齊藤工などアジアの監督が、各国の食をテーマに描いたアンソロジーシリーズ。(全8話)(19年 シンガポール 56分)",
|
||||||
|
"attr":[
|
||||||
|
"5.1",
|
||||||
|
"hd",
|
||||||
|
"cp1"
|
||||||
|
],
|
||||||
|
"sortGenre":"31",
|
||||||
|
"hasImage":1,
|
||||||
|
"imgPath":"/monomedia/si/2022/20220114/7305523/image/7743d17b655b8d2274ca58b74f2f095c.jpg",
|
||||||
|
"isRecommended":null,
|
||||||
|
"programStart":20220114050000,
|
||||||
|
"programEnd":20220114060000,
|
||||||
|
"programDate":20220114,
|
||||||
|
"programId":568519,
|
||||||
|
"start_time":"00",
|
||||||
|
"duration":60,
|
||||||
|
"top":300,
|
||||||
|
"end_time":"20220114060000",
|
||||||
|
"channel_type":"120",
|
||||||
|
"is_end":false,
|
||||||
|
"show_remoterec":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
1
sites/tvguide.myjcom.jp/__data__/no_content.json
Normal file
1
sites/tvguide.myjcom.jp/__data__/no_content.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"120_200_3_20220114":[]}
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
const { parser, url } = require('./tvguide.myjcom.jp.config.js')
|
const { parser, url } = require('./tvguide.myjcom.jp.config.js')
|
||||||
const dayjs = require('dayjs')
|
const dayjs = require('dayjs')
|
||||||
|
const fs = require('fs')
|
||||||
|
const path = require('path')
|
||||||
const utc = require('dayjs/plugin/utc')
|
const utc = require('dayjs/plugin/utc')
|
||||||
const customParseFormat = require('dayjs/plugin/customParseFormat')
|
const customParseFormat = require('dayjs/plugin/customParseFormat')
|
||||||
dayjs.extend(customParseFormat)
|
dayjs.extend(customParseFormat)
|
||||||
@@ -11,8 +13,7 @@ const channel = {
|
|||||||
name: 'Star Channel 1',
|
name: 'Star Channel 1',
|
||||||
xmltv_id: 'StarChannel1.jp'
|
xmltv_id: 'StarChannel1.jp'
|
||||||
}
|
}
|
||||||
const content =
|
const content = fs.readFileSync(path.resolve(__dirname, './__data__/content.json'), 'utf8')
|
||||||
'{"120_200_4_20220114":[{"@search.score":1,"cid":"120_7305523","serviceCode":"200_4","channelName":"スターチャンネル1","digitalNo":195,"eventId":"181","title":"[5.1]フードロア:タマリンド","commentary":"HBO(R)アジア製作。日本の齊藤工などアジアの監督が、各国の食をテーマに描いたアンソロジーシリーズ。(全8話)(19年 シンガポール 56分)","attr":["5.1","hd","cp1"],"sortGenre":"31","hasImage":1,"imgPath":"/monomedia/si/2022/20220114/7305523/image/7743d17b655b8d2274ca58b74f2f095c.jpg","isRecommended":null,"programStart":20220114050000,"programEnd":20220114060000,"programDate":20220114,"programId":568519,"start_time":"00","duration":60,"top":300,"end_time":"20220114060000","channel_type":"120","is_end":false,"show_remoterec":true}]}'
|
|
||||||
|
|
||||||
it('can generate valid url', () => {
|
it('can generate valid url', () => {
|
||||||
const result = url({ date, channel })
|
const result = url({ date, channel })
|
||||||
@@ -44,7 +45,7 @@ it('can handle empty guide', () => {
|
|||||||
const result = parser({
|
const result = parser({
|
||||||
date,
|
date,
|
||||||
channel,
|
channel,
|
||||||
content: '{"120_200_3_20220114":[]}'
|
content: fs.readFileSync(path.resolve(__dirname, './__data__/no_content.json'), 'utf8')
|
||||||
})
|
})
|
||||||
expect(result).toMatchObject([])
|
expect(result).toMatchObject([])
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
const { parser, url } = require('./tvheute.at.config.js')
|
const { parser, url } = require('./tvheute.at.config.js')
|
||||||
const dayjs = require('dayjs')
|
const dayjs = require('dayjs')
|
||||||
|
const path = require('path')
|
||||||
const utc = require('dayjs/plugin/utc')
|
const utc = require('dayjs/plugin/utc')
|
||||||
const customParseFormat = require('dayjs/plugin/customParseFormat')
|
const customParseFormat = require('dayjs/plugin/customParseFormat')
|
||||||
const { readFileSync } = require('fs')
|
const { readFileSync } = require('fs')
|
||||||
@@ -16,7 +17,7 @@ it('can generate valid url', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('can parse response', () => {
|
it('can parse response', () => {
|
||||||
expect(parser({ date, channel, content: readFileSync('./__data__/content.html', 'utf8') })).toMatchObject([
|
expect(parser({ date, channel, content: readFileSync(path.resolve(__dirname, './__data__/content.html'), 'utf8') })).toMatchObject([
|
||||||
{
|
{
|
||||||
start: '2021-11-08T05:00:00.000Z',
|
start: '2021-11-08T05:00:00.000Z',
|
||||||
stop: '2021-11-08T05:10:00.000Z',
|
stop: '2021-11-08T05:10:00.000Z',
|
||||||
@@ -38,7 +39,7 @@ it('can handle empty guide', () => {
|
|||||||
const result = parser({
|
const result = parser({
|
||||||
date,
|
date,
|
||||||
channel,
|
channel,
|
||||||
content: readFileSync('./__data__/no_content.html', 'utf8')
|
content: readFileSync(path.resolve(__dirname, './__data__/no_content.html'), 'utf8')
|
||||||
})
|
})
|
||||||
expect(result).toMatchObject([])
|
expect(result).toMatchObject([])
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user