mirror of
https://github.com/iptv-org/epg
synced 2025-12-18 11:27:06 -05:00
fix tests
This commit is contained in:
@@ -2,6 +2,8 @@ const { parser, url } = require('./allente.dk.config.js')
|
|||||||
const dayjs = require('dayjs')
|
const dayjs = require('dayjs')
|
||||||
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 { resolve } = require('path')
|
||||||
dayjs.extend(customParseFormat)
|
dayjs.extend(customParseFormat)
|
||||||
dayjs.extend(utc)
|
dayjs.extend(utc)
|
||||||
|
|
||||||
@@ -16,8 +18,7 @@ it('can generate valid url', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('can parse response', () => {
|
it('can parse response', () => {
|
||||||
const content =
|
const content = readFileSync(resolve(__dirname, '__data__/content.json'))
|
||||||
''
|
|
||||||
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 +1,34 @@
|
|||||||
{"channel-programme":[{"id":"31cc8b4c-3711-49f0-bf22-2ec3993b0a07","programmeTitle":"NRL","title":"Eels v Titans","startTime":"2022-12-14T00:00:00+11:00","endTime":"2022-12-14T01:00:00+11:00","duration":60,"live":false,"genreId":"5c389cf4-8db7-4b52-9773-52355bd28559","channelId":2,"channelName":"FOX League","channelAbbreviation":"LEAGUE","programmeUID":235220,"round":"R1","statsMatchId":null,"closedCaptioned":true,"statsFixtureId":10207,"genreTitle":"Rugby League","parentGenreId":"a953f929-2d12-41a4-b0e9-97f401afff11","parentGenreTitle":"Sport","pmgId":"PMG01306944","statsSport":"league","type":"GAME","hiDef":true,"widescreen":true,"classification":"","synopsis":"The Eels and Titans have plenty of motivation this season after heartbreaking Finals losses in 2021. Parramatta has won their past five against Gold Coast.","preGameStartTime":null,"closeCaptioned":true}]}
|
{
|
||||||
|
"channel-programme":[
|
||||||
|
{
|
||||||
|
"id":"31cc8b4c-3711-49f0-bf22-2ec3993b0a07",
|
||||||
|
"programmeTitle":"NRL",
|
||||||
|
"title":"Eels v Titans",
|
||||||
|
"startTime":"2022-12-14T00:00:00+11:00",
|
||||||
|
"endTime":"2022-12-14T01:00:00+11:00",
|
||||||
|
"duration":60,
|
||||||
|
"live":false,
|
||||||
|
"genreId":"5c389cf4-8db7-4b52-9773-52355bd28559",
|
||||||
|
"channelId":2,
|
||||||
|
"channelName":"FOX League",
|
||||||
|
"channelAbbreviation":"LEAGUE",
|
||||||
|
"programmeUID":235220,
|
||||||
|
"round":"R1",
|
||||||
|
"statsMatchId":null,
|
||||||
|
"closedCaptioned":true,
|
||||||
|
"statsFixtureId":10207,
|
||||||
|
"genreTitle":"Rugby League",
|
||||||
|
"parentGenreId":"a953f929-2d12-41a4-b0e9-97f401afff11",
|
||||||
|
"parentGenreTitle":"Sport",
|
||||||
|
"pmgId":"PMG01306944",
|
||||||
|
"statsSport":"league",
|
||||||
|
"type":"GAME",
|
||||||
|
"hiDef":true,
|
||||||
|
"widescreen":true,
|
||||||
|
"classification":"",
|
||||||
|
"synopsis":"The Eels and Titans have plenty of motivation this season after heartbreaking Finals losses in 2021. Parramatta has won their past five against Gold Coast.",
|
||||||
|
"preGameStartTime":null,
|
||||||
|
"closeCaptioned":true
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@@ -38,6 +38,6 @@ it('can parse response', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('can handle empty guide', () => {
|
it('can handle empty guide', () => {
|
||||||
const result = parser({content: ''}, channel)
|
const result = parser({content: fs.readFileSync(path.resolve(__dirname, '__data__/no_content.json'))}, channel)
|
||||||
expect(result).toMatchObject([])
|
expect(result).toMatchObject([])
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
{"count":83,"next":null,"previous":null,"results":[{"id":135605,"video":{"id":626094,"name":"FSCONS 2017 - Keynote: TBA - Linda Sandvik","header":"Linda Sandvik's keynote at FSCONS 2017\\r\\n\\r\\nRecorded by NUUG for FSCONS.","description":null,"creator":"davidwnoble@gmail.com","organization":{"id":82,"name":"NUUG","homepage":"https://www.nuug.no/","description":"Forening NUUG er for alle som er interessert i fri programvare, åpne standarder og Unix-lignende operativsystemer.","postalAddress":"","streetAddress":"","editorId":2148,"editorName":"David Noble","editorEmail":"davidwnoble@gmail.com","editorMsisdn":"","fkmember":true},"duration":"00:57:55.640000","categories":["Samfunn"]},"schedulereason":5,"starttime":"2022-01-19T00:47:00+01:00","endtime":"2022-01-19T01:44:55.640000+01:00","duration":"00:57:55.640000"}]}
|
{"count":83,"next":null,"previous":null,"results":[{"id":135605,"video":{"id":626094,"name":"FSCONS 2017 - Keynote: TBA - Linda Sandvik","header":"Linda Sandvik's keynote at FSCONS 2017\r\n\r\nRecorded by NUUG for FSCONS.","description":null,"creator":"davidwnoble@gmail.com","organization":{"id":82,"name":"NUUG","homepage":"https://www.nuug.no/","description":"Forening NUUG er for alle som er interessert i fri programvare, åpne standarder og Unix-lignende operativsystemer.","postalAddress":"","streetAddress":"","editorId":2148,"editorName":"David Noble","editorEmail":"davidwnoble@gmail.com","editorMsisdn":"","fkmember":true},"duration":"00:57:55.640000","categories":["Samfunn"]},"schedulereason":5,"starttime":"2022-01-19T00:47:00+01:00","endtime":"2022-01-19T01:44:55.640000+01:00","duration":"00:57:55.640000"}]}
|
||||||
Reference in New Issue
Block a user