mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 09:00:07 -04:00
fixed test
This commit is contained in:
parent
470605534a
commit
259af9879c
1 changed files with 13 additions and 25 deletions
|
@ -17,45 +17,33 @@ it('can generate valid url', () => {
|
||||||
expect(url({ date })).toBe(`https://epg.orangetv.orange.es/epg/Smartphone_Android/1_PRO/${date.format('YYYYMMDD')}_8h_1.json`)
|
expect(url({ date })).toBe(`https://epg.orangetv.orange.es/epg/Smartphone_Android/1_PRO/${date.format('YYYYMMDD')}_8h_1.json`)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('can parse response', () => {
|
it('can parse response', async () => {
|
||||||
const content = fs.readFileSync(path.resolve(__dirname, '__data__/data.json')).toString()
|
const content = fs.readFileSync(path.resolve(__dirname, '__data__/data.json')).toString()
|
||||||
const results = parser({ content, channel, date }).map(p => {
|
let results = await parser({ content, channel, date })
|
||||||
|
results = results.map(p => {
|
||||||
p.start = p.start.toJSON()
|
p.start = p.start.toJSON()
|
||||||
p.stop = p.stop.toJSON()
|
p.stop = p.stop.toJSON()
|
||||||
return p
|
return p
|
||||||
})
|
})
|
||||||
|
|
||||||
expect(results.length).toBe(21)
|
expect(results.length).toBe(4)
|
||||||
|
|
||||||
var sampleResult = results[0];
|
var sampleResult = results[0];
|
||||||
|
|
||||||
expect(sampleResult).toMatchObject([
|
expect(sampleResult).toMatchObject({
|
||||||
{
|
start: '2024-11-30T22:36:51.000Z',
|
||||||
start: '2022-03-11T05:00:00.000Z',
|
stop: '2024-11-30T23:57:25.000Z',
|
||||||
stop: '2022-03-11T07:30:00.000Z',
|
category: ['Cine', 'Romance', 'Comedia', 'Comedia Romántica'],
|
||||||
category: 'Información',
|
description: 'Charlie trabaja como director en una escuela de primaria y goza de una placentera existencia junto a sus amigos. A pesar de ello, no es feliz porque cada vez que se enamora pierde la cordura.',
|
||||||
title: 'Telediario Matinal'
|
title: 'Loco de amor'
|
||||||
},
|
})
|
||||||
{
|
|
||||||
start: '2022-03-11T21:15:00.000Z',
|
|
||||||
stop: '2022-03-11T23:30:00.000Z',
|
|
||||||
category: 'Información',
|
|
||||||
title: 'Las Claves del Siglo XXI: Episodio 8'
|
|
||||||
},
|
|
||||||
{
|
|
||||||
start: '2022-03-12T02:10:00.000Z',
|
|
||||||
stop: '2022-03-12T05:00:00.000Z',
|
|
||||||
category: 'Información',
|
|
||||||
title: 'Noticias 24H'
|
|
||||||
}
|
|
||||||
])
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it('can handle empty guide', () => {
|
it('can handle empty guide', () => {
|
||||||
const result = parser({
|
const result = parser({
|
||||||
date,
|
date,
|
||||||
channel,
|
channel,
|
||||||
content: '[]'
|
content: '{}'
|
||||||
})
|
})
|
||||||
expect(result).toMatchObject([])
|
expect(result).toMatchObject({})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue