mirror of
https://github.com/iptv-org/epg
synced 2025-12-16 10:26:41 -05:00
finish uniformizing tests
This commit is contained in:
58
sites/ipko.tv/__data__/content.json
Normal file
58
sites/ipko.tv/__data__/content.json
Normal file
@@ -0,0 +1,58 @@
|
||||
{
|
||||
"shows": [
|
||||
{
|
||||
"title": "IPKO Promo",
|
||||
"show_start": 1735012800,
|
||||
"show_end": 1735020000,
|
||||
"timestamp": "5:00 - 7:00",
|
||||
"show_id": "EPG_TvProfil_IPKOPROMO_296105567",
|
||||
"thumbnail": "https://vimg.ipko.tv/mtcms/18/2/1/1821cc68-a9bf-4733-b1af-9a5d80163b78.jpg",
|
||||
"is_adult": false,
|
||||
"friendly_id": "ipko_promo_4cf3",
|
||||
"pg": "",
|
||||
"genres": [],
|
||||
"year": 0,
|
||||
"summary": "",
|
||||
"categories": "Other",
|
||||
"stb_only": false,
|
||||
"is_live": false,
|
||||
"original_title": "IPKO Promo"
|
||||
},
|
||||
{
|
||||
"title": "IPKO Promo",
|
||||
"show_start": 1735020000,
|
||||
"show_end": 1735027200,
|
||||
"timestamp": "7:00 - 9:00",
|
||||
"show_id": "EPG_TvProfil_IPKOPROMO_296105568",
|
||||
"thumbnail": "https://vimg.ipko.tv/mtcms/18/2/1/1821cc68-a9bf-4733-b1af-9a5d80163b78.jpg",
|
||||
"is_adult": false,
|
||||
"friendly_id": "ipko_promo_416b",
|
||||
"pg": "",
|
||||
"genres": [],
|
||||
"year": 0,
|
||||
"summary": "",
|
||||
"categories": "Other",
|
||||
"stb_only": false,
|
||||
"is_live": false,
|
||||
"original_title": "IPKO Promo"
|
||||
},
|
||||
{
|
||||
"title": "IPKO Promo",
|
||||
"show_start": 1735027200,
|
||||
"show_end": 1735034400,
|
||||
"timestamp": "9:00 - 11:00",
|
||||
"show_id": "EPG_TvProfil_IPKOPROMO_296105569",
|
||||
"thumbnail": "https://vimg.ipko.tv/mtcms/18/2/1/1821cc68-a9bf-4733-b1af-9a5d80163b78.jpg",
|
||||
"is_adult": false,
|
||||
"friendly_id": "ipko_promo_2e23",
|
||||
"pg": "",
|
||||
"genres": [],
|
||||
"year": 0,
|
||||
"summary": "",
|
||||
"categories": "Other",
|
||||
"stb_only": false,
|
||||
"is_live": false,
|
||||
"original_title": "IPKO Promo"
|
||||
}
|
||||
]
|
||||
}
|
||||
1
sites/ipko.tv/__data__/no_content.json
Normal file
1
sites/ipko.tv/__data__/no_content.json
Normal file
@@ -0,0 +1 @@
|
||||
{"shows":[]}
|
||||
@@ -1,4 +1,6 @@
|
||||
const { parser, url } = require('./ipko.tv.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')
|
||||
@@ -16,66 +18,7 @@ it('can generate valid url', () => {
|
||||
})
|
||||
|
||||
it('can parse response', () => {
|
||||
const content = `
|
||||
{
|
||||
"shows": [
|
||||
{
|
||||
"title": "IPKO Promo",
|
||||
"show_start": 1735012800,
|
||||
"show_end": 1735020000,
|
||||
"timestamp": "5:00 - 7:00",
|
||||
"show_id": "EPG_TvProfil_IPKOPROMO_296105567",
|
||||
"thumbnail": "https://vimg.ipko.tv/mtcms/18/2/1/1821cc68-a9bf-4733-b1af-9a5d80163b78.jpg",
|
||||
"is_adult": false,
|
||||
"friendly_id": "ipko_promo_4cf3",
|
||||
"pg": "",
|
||||
"genres": [],
|
||||
"year": 0,
|
||||
"summary": "",
|
||||
"categories": "Other",
|
||||
"stb_only": false,
|
||||
"is_live": false,
|
||||
"original_title": "IPKO Promo"
|
||||
},
|
||||
{
|
||||
"title": "IPKO Promo",
|
||||
"show_start": 1735020000,
|
||||
"show_end": 1735027200,
|
||||
"timestamp": "7:00 - 9:00",
|
||||
"show_id": "EPG_TvProfil_IPKOPROMO_296105568",
|
||||
"thumbnail": "https://vimg.ipko.tv/mtcms/18/2/1/1821cc68-a9bf-4733-b1af-9a5d80163b78.jpg",
|
||||
"is_adult": false,
|
||||
"friendly_id": "ipko_promo_416b",
|
||||
"pg": "",
|
||||
"genres": [],
|
||||
"year": 0,
|
||||
"summary": "",
|
||||
"categories": "Other",
|
||||
"stb_only": false,
|
||||
"is_live": false,
|
||||
"original_title": "IPKO Promo"
|
||||
},
|
||||
{
|
||||
"title": "IPKO Promo",
|
||||
"show_start": 1735027200,
|
||||
"show_end": 1735034400,
|
||||
"timestamp": "9:00 - 11:00",
|
||||
"show_id": "EPG_TvProfil_IPKOPROMO_296105569",
|
||||
"thumbnail": "https://vimg.ipko.tv/mtcms/18/2/1/1821cc68-a9bf-4733-b1af-9a5d80163b78.jpg",
|
||||
"is_adult": false,
|
||||
"friendly_id": "ipko_promo_2e23",
|
||||
"pg": "",
|
||||
"genres": [],
|
||||
"year": 0,
|
||||
"summary": "",
|
||||
"categories": "Other",
|
||||
"stb_only": false,
|
||||
"is_live": false,
|
||||
"original_title": "IPKO Promo"
|
||||
}
|
||||
]
|
||||
}`
|
||||
|
||||
const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.json'))
|
||||
const result = parser({ content, channel })
|
||||
|
||||
expect(result).toMatchObject([
|
||||
@@ -105,7 +48,7 @@ it('can parse response', () => {
|
||||
|
||||
it('can handle empty guide', () => {
|
||||
const result = parser({
|
||||
content: '{"shows":[]}'
|
||||
content: fs.readFileSync(path.resolve(__dirname, '__data__/no_content.json'))
|
||||
})
|
||||
expect(result).toMatchObject([])
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user