Update unifi.com.my.test.js

Added `--timeout=30000` to test command
This commit is contained in:
Aleksandr Statciuk 2023-01-12 00:30:58 +03:00
parent d46f4a485b
commit bdcfd656c7
1 changed files with 27 additions and 27 deletions

View File

@ -1,4 +1,4 @@
// npx epg-grabber --config=sites/unifi.com.my/unifi.com.my.config.js --channels=sites/unifi.com.my/unifi.com.my.channels.xml --output=guide.xml --days=2
// npx epg-grabber --config=sites/unifi.com.my/unifi.com.my.config.js --channels=sites/unifi.com.my/unifi.com.my.channels.xml --output=guide.xml --days=2 --timeout=30000
const { parser, url, request } = require('./unifi.com.my.config.js')
const dayjs = require('dayjs')
@ -9,44 +9,44 @@ dayjs.extend(utc)
const date = dayjs.utc('2023-01-09', 'YYYY-MM-DD').startOf('d')
const channel = {
site_id: '51882833',
xmltv_id: 'AXNMalaysia.my'
site_id: '51882833',
xmltv_id: 'AXNMalaysia.my'
}
it('can generate valid url', () => {
expect(url).toBe(`https://unifi.com.my/tv/api/tv`)
expect(url).toBe(`https://unifi.com.my/tv/api/tv`)
})
it('can generate valid request method', () => {
expect(request.method).toBe('POST')
expect(request.method).toBe('POST')
})
it('can generate valid request headers', () => {
expect(request.headers).toMatchObject({
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
})
expect(request.headers).toMatchObject({
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
})
})
it('can parse response', () => {
const content = `[{"id":"51882833","name":"AXN","logo":"https://playtv.unifi.com.my:7047/CPS/images/universal/film/logo/202109/20210927/2021092701574706798y.png","items":[{"name":"Blue Bloods (Season 11)","interval":"one","minute":55,"start_time":"4:20am","end_time":"5:15am"}]}]`
const content = `[{"id":"51882833","name":"AXN","logo":"https://playtv.unifi.com.my:7047/CPS/images/universal/film/logo/202109/20210927/2021092701574706798y.png","items":[{"name":"Blue Bloods (Season 11)","interval":"one","minute":55,"start_time":"4:20am","end_time":"5:15am"}]}]`
const result = parser({ content, channel, date }).map(p => {
p.start = p.start.toJSON()
p.stop = p.stop.toJSON()
return p
})
expect(result).toMatchObject([
{
title: 'Blue Bloods (Season 11)',
start: '2023-01-08T20:20:00.000Z',
stop: '2023-01-08T21:15:00.000Z'
}
])
const result = parser({ content, channel, date }).map(p => {
p.start = p.start.toJSON()
p.stop = p.stop.toJSON()
return p
})
it('can handle empty guide', () => {
const content = `[{"id":"51882833","name":"AXN","logo":"https://playtv.unifi.com.my:7047/CPS/images/universal/film/logo/202109/20210927/2021092701574706798y.png","items":[]}]`
const result = parser({ content, channel })
expect(result).toMatchObject([])
})
expect(result).toMatchObject([
{
title: 'Blue Bloods (Season 11)',
start: '2023-01-08T20:20:00.000Z',
stop: '2023-01-08T21:15:00.000Z'
}
])
})
it('can handle empty guide', () => {
const content = `[{"id":"51882833","name":"AXN","logo":"https://playtv.unifi.com.my:7047/CPS/images/universal/film/logo/202109/20210927/2021092701574706798y.png","items":[]}]`
const result = parser({ content, channel })
expect(result).toMatchObject([])
})