mirror of
https://github.com/iptv-org/epg
synced 2026-05-07 18:07:05 -04:00
Update mytelly.co.uk.test.js
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
const { parser, url } = require('./mytelly.co.uk.config.js')
|
||||
const axios = require('axios')
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const dayjs = require('dayjs')
|
||||
@@ -9,35 +8,12 @@ const customParseFormat = require('dayjs/plugin/customParseFormat')
|
||||
dayjs.extend(customParseFormat)
|
||||
dayjs.extend(utc)
|
||||
|
||||
jest.mock('axios')
|
||||
|
||||
const date = dayjs.utc('2024-12-07', 'YYYY-MM-DD').startOf('d')
|
||||
const channel = {
|
||||
site_id: '713/bbc-one-london',
|
||||
xmltv_id: 'BBCOneLondon.uk'
|
||||
}
|
||||
|
||||
axios.get.mockImplementation(url => {
|
||||
if (
|
||||
url ===
|
||||
'https://www.mytelly.co.uk/tv-guide/listings/programme?cid=713&pid=1906433&tm=2024-12-07+00%3A00%3A00'
|
||||
) {
|
||||
return Promise.resolve({
|
||||
data: fs.readFileSync(path.join(__dirname, '__data__', 'programme.html'))
|
||||
})
|
||||
}
|
||||
if (
|
||||
url ===
|
||||
'https://www.mytelly.co.uk/tv-guide/listings/programme?cid=713&pid=5656624&tm=2024-12-07+23%3A35%3A00'
|
||||
) {
|
||||
return Promise.resolve({
|
||||
data: fs.readFileSync(path.join(__dirname, '__data__', 'programme2.html'))
|
||||
})
|
||||
}
|
||||
|
||||
return Promise.resolve({ data: '' })
|
||||
})
|
||||
|
||||
it('can generate valid url', () => {
|
||||
expect(url({ channel, date })).toBe(
|
||||
'https://www.mytelly.co.uk/tv-guide/listings/channel/713/bbc-one-london.html?dt=2024-12-07'
|
||||
@@ -52,29 +28,17 @@ it('can parse response', async () => {
|
||||
return p
|
||||
})
|
||||
|
||||
expect(results.length).toBe(2)
|
||||
expect(results.length).toBe(25)
|
||||
expect(results[0]).toMatchObject({
|
||||
start: '2024-12-07T00:00:00.000Z',
|
||||
stop: '2024-12-07T02:05:00.000Z',
|
||||
title: 'Captain Phillips',
|
||||
description:
|
||||
'An American cargo ship sets a dangerous course around the coast of Somalia, while inland, four men are pressed into service as pirates by the local warlords. The captain is taken hostage when the raiding party hijacks the vessel, resulting in a tense five-day crisis. Fact-based thriller, starring Tom Hanks and Barkhad Abdi',
|
||||
image:
|
||||
'https://d16ia5iwuvax6y.cloudfront.net/uk-prog-images/c44ce7b0d3ae602c0c93ece5af140815.jpg?k=VeeNdUjml3bSHdlZ0OXbGLy%2BmsLdYPwTV6iAxGkzq4dsylOCGGE7OWlqwSWt0cd0Qtrin4DkEMC0Zzdp8ZeNk2vNIQzjMF0DG0h3IeTR5NM%3D',
|
||||
category: ['Factual', 'Movie/Drama', 'Thriller']
|
||||
title: 'Captain Phillips (2013)'
|
||||
})
|
||||
expect(results[1]).toMatchObject({
|
||||
expect(results[24]).toMatchObject({
|
||||
start: '2024-12-07T23:35:00.000Z',
|
||||
stop: '2024-12-08T00:40:00.000Z',
|
||||
stop: '2024-12-08T00:05:00.000Z',
|
||||
title: 'The Rap Game UK',
|
||||
subTitle: 'Past and Pressure Season 6, Episode 5',
|
||||
description:
|
||||
'The artists are tasked with writing a song about their heritage. For some, the pressure of the competition proves too much for them to match. In their final challenge, they are put face to face with industry experts who grill them about their plans after the competition. Some impress, while others leave the mentors confused',
|
||||
image:
|
||||
'https://d16ia5iwuvax6y.cloudfront.net/uk-prog-images/2039278182b27cc279570b9ab9b89379.jpg?k=VeeNdUjml3bSHdlZ0OXbGLy%2BmsLdYPwTV6iAxGkzq4cDhR7jXTNFW3tgwQCdOPUobhXwlT81mIsqOe93HPusDG6tw1aoeYOgafojtynNWxc%3D',
|
||||
category: ['Challenge/Reality Show', 'Show/Game Show'],
|
||||
season: 6,
|
||||
episode: 5
|
||||
subTitle: 'Past and Pressure - Season 6, Episode 5'
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user