Update foxsports.com.au.test.js

This commit is contained in:
Aleksandr Statciuk 2022-12-16 01:43:12 +03:00
parent 3fc8c8e41d
commit 9a94a3ec4d

View file

@ -1,3 +1,4 @@
// npx epg-grabber --config=sites/foxsports.com.au/foxsports.com.au.config.js --channels=sites/foxsports.com.au/foxsports.com.au_au.channels.xml --output=guide.xml --days=2
const { parser, url } = require('./foxsports.com.au.config.js') const { parser, url } = require('./foxsports.com.au.config.js')
const dayjs = require('dayjs') const dayjs = require('dayjs')
@ -8,7 +9,7 @@ const date = dayjs.utc('2022-12-14', 'YYYY-MM-DD').startOf('d')
const channel = { const channel = {
site_id: '2', site_id: '2',
xmltv_id: 'FoxLeague.au' xmltv_id: 'FoxLeague.au'
} }
it('can generate valid url', () => { it('can generate valid url', () => {
expect(url({ date })).toBe( expect(url({ date })).toBe(
'https://tvguide.foxsports.com.au/granite-api/programmes.json?from=2022-12-14&to=2022-12-15' 'https://tvguide.foxsports.com.au/granite-api/programmes.json?from=2022-12-14&to=2022-12-15'
@ -37,8 +38,11 @@ it('can parse response', () => {
}) })
it('can handle empty guide', () => { it('can handle empty guide', () => {
const result = parser({ const result = parser(
{
content: `{"channel-programme":[]}` content: `{"channel-programme":[]}`
}, channel) },
channel
)
expect(result).toMatchObject([]) expect(result).toMatchObject([])
}) })