From 259af9879cee146ec8acf83c1d61f33abeefe249 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Moret?= <30985701+BellezaEmporium@users.noreply.github.com> Date: Thu, 19 Dec 2024 23:06:11 +0100 Subject: [PATCH] fixed test --- sites/orangetv.es/orangetv.es.test.js | 38 +++++++++------------------ 1 file changed, 13 insertions(+), 25 deletions(-) diff --git a/sites/orangetv.es/orangetv.es.test.js b/sites/orangetv.es/orangetv.es.test.js index 8319aab4..3e4db35c 100644 --- a/sites/orangetv.es/orangetv.es.test.js +++ b/sites/orangetv.es/orangetv.es.test.js @@ -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`) }) -it('can parse response', () => { +it('can parse response', async () => { 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.stop = p.stop.toJSON() return p }) - expect(results.length).toBe(21) + expect(results.length).toBe(4) var sampleResult = results[0]; - expect(sampleResult).toMatchObject([ - { - start: '2022-03-11T05:00:00.000Z', - stop: '2022-03-11T07:30:00.000Z', - category: 'Información', - title: 'Telediario Matinal' - }, - { - 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' - } - ]) + expect(sampleResult).toMatchObject({ + start: '2024-11-30T22:36:51.000Z', + stop: '2024-11-30T23:57:25.000Z', + category: ['Cine', 'Romance', 'Comedia', 'Comedia Romántica'], + 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: 'Loco de amor' + }) }) it('can handle empty guide', () => { const result = parser({ date, channel, - content: '[]' + content: '{}' }) - expect(result).toMatchObject([]) + expect(result).toMatchObject({}) })