Updating mediaset tests

This commit is contained in:
sicilykill 2024-01-20 11:07:34 -06:00
parent eb277f1f2a
commit 2fd0581746
3 changed files with 8 additions and 22 deletions

File diff suppressed because one or more lines are too long

View file

@ -1,10 +0,0 @@
<!DOCTYPE html PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html>
<head>
<title>301 Moved Permanently</title>
</head>
<body>
<h1>Moved Permanently</h1>
<p>The document has moved <a href="https://mediasetinfinity.mediaset.it/">here</a>.</p>
</body>
</html>

View file

@ -7,7 +7,7 @@ const customParseFormat = require('dayjs/plugin/customParseFormat')
dayjs.extend(customParseFormat)
dayjs.extend(utc)
const date = dayjs.utc('2023-10-20', 'YYYY-MM-DD').startOf('d')
const date = dayjs.utc('2024-01-20', 'YYYY-MM-DD').startOf('d')
const channel = {
site_id: 'LB',
xmltv_id: '20.it'
@ -15,30 +15,27 @@ const channel = {
it('can generate valid url', () => {
expect(url({ channel, date })).toBe(
'http://www.mediaset.it/guidatv/inc/canali/202310/20231020_LB.sjson'
'https://api-ott-prod-fe.mediaset.net/PROD/play/feed/allListingFeedEpg/v2.0?byListingTime=1705708800000~1705795200000&byCallSign=LB'
)
})
it('can parse response', () => {
const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.json'), 'utf8')
const results = parser({ content, date }).map(p => {
p.start = p.start.toJSON()
p.stop = p.stop.toJSON()
return p
})
expect(results[0]).toMatchObject({
start: '2023-10-20T04:10:00.000Z',
stop: '2023-10-20T05:07:00.000Z',
title: 'Showreel',
description: 'INTRATTENIMENTO 15 - Italia, 2023',
category: 'INTRATTENIMENTO'
start: '2024-01-19 22:37',
stop: '2024-01-20 00:54',
title: 'Independence day: Rigenerazione',
description: 'Sequel del film di fantascienza Independence Day, con L. Hemsworth e B. Pullman. Dopo 20 anni la Terra si prepara a subire un secondo, terrificante attacco alieno.',
})
})
it('can handle empty guide', () => {
const result = parser({
content: fs.readFileSync(path.resolve(__dirname, '__data__/no_content.html'), 'utf8')
content: '[]'
})
expect(result).toMatchObject([])
})