mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-09 08:30:06 -04:00
Create makrodigitaltelevision.com.test.js
This commit is contained in:
parent
1c9a2cc088
commit
6fd72128ef
1 changed files with 39 additions and 0 deletions
|
@ -0,0 +1,39 @@
|
|||
const { parser, url } = require('./makrodigitaltelevision.com.config.js')
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const dayjs = require('dayjs')
|
||||
const utc = require('dayjs/plugin/utc')
|
||||
const customParseFormat = require('dayjs/plugin/customParseFormat')
|
||||
dayjs.extend(customParseFormat)
|
||||
dayjs.extend(utc)
|
||||
|
||||
const date = dayjs.utc('2025-02-16', 'YYYY-MM-DD').startOf('d')
|
||||
const channel = { site_id: '17' }
|
||||
|
||||
it('can generate valid url', () => {
|
||||
expect(url).toBe('https://makrodigitaltelevision.com/epg.xml')
|
||||
})
|
||||
|
||||
it('can parse response', () => {
|
||||
const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.xml'))
|
||||
|
||||
const results = parser({ content, channel, date })
|
||||
|
||||
expect(results.length).toBe(8)
|
||||
expect(results[0]).toMatchObject({
|
||||
title: 'Programación Infantil',
|
||||
start: '2025-02-16T13:00:00.000Z',
|
||||
stop: '2025-02-16T17:00:00.000Z'
|
||||
})
|
||||
expect(results[7]).toMatchObject({
|
||||
title: 'Comunicación Cristiana',
|
||||
start: '2025-02-16T23:30:00.000Z',
|
||||
stop: '2025-02-17T00:00:00.000Z'
|
||||
})
|
||||
})
|
||||
|
||||
it('can handle empty guide', () => {
|
||||
const results = parser({ content: '' })
|
||||
|
||||
expect(results).toMatchObject([])
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue