finish uniformizing tests

This commit is contained in:
theofficialomega
2025-07-27 19:49:44 +02:00
parent f6738a9629
commit 851aba2438
87 changed files with 351 additions and 403 deletions

View 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"
}
]
}

View File

@@ -0,0 +1 @@
{"shows":[]}

View File

@@ -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([])
})