uniformise tests part 1

This commit is contained in:
theofficialomega
2025-07-12 13:24:07 +02:00
parent be7db6a324
commit 12849d2350
14 changed files with 5259 additions and 14 deletions

View File

@@ -0,0 +1,34 @@
{
"120_200_4_20220114":[
{
"@search.score":1,
"cid":"120_7305523",
"serviceCode":"200_4",
"channelName":"スターチャンネル1",
"digitalNo":195,
"eventId":"181",
"title":"[5.1]フードロア:タマリンド",
"commentary":"HBO(R)アジア製作。日本の齊藤工などアジアの監督が、各国の食をテーマに描いたアンソロジーシリーズ。(全8話)(19年 シンガポール 56分)",
"attr":[
"5.1",
"hd",
"cp1"
],
"sortGenre":"31",
"hasImage":1,
"imgPath":"/monomedia/si/2022/20220114/7305523/image/7743d17b655b8d2274ca58b74f2f095c.jpg",
"isRecommended":null,
"programStart":20220114050000,
"programEnd":20220114060000,
"programDate":20220114,
"programId":568519,
"start_time":"00",
"duration":60,
"top":300,
"end_time":"20220114060000",
"channel_type":"120",
"is_end":false,
"show_remoterec":true
}
]
}

View File

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

View File

@@ -1,5 +1,7 @@
const { parser, url } = require('./tvguide.myjcom.jp.config.js')
const dayjs = require('dayjs')
const fs = require('fs')
const path = require('path')
const utc = require('dayjs/plugin/utc')
const customParseFormat = require('dayjs/plugin/customParseFormat')
dayjs.extend(customParseFormat)
@@ -11,8 +13,7 @@ const channel = {
name: 'Star Channel 1',
xmltv_id: 'StarChannel1.jp'
}
const content =
'{"120_200_4_20220114":[{"@search.score":1,"cid":"120_7305523","serviceCode":"200_4","channelName":"スターチャンネル1","digitalNo":195,"eventId":"181","title":"[5.1]フードロア:タマリンド","commentary":"HBO(R)アジア製作。日本の齊藤工などアジアの監督が、各国の食をテーマに描いたアンソロジーシリーズ。(全8話)(19年 シンガポール 56分)","attr":["5.1","hd","cp1"],"sortGenre":"31","hasImage":1,"imgPath":"/monomedia/si/2022/20220114/7305523/image/7743d17b655b8d2274ca58b74f2f095c.jpg","isRecommended":null,"programStart":20220114050000,"programEnd":20220114060000,"programDate":20220114,"programId":568519,"start_time":"00","duration":60,"top":300,"end_time":"20220114060000","channel_type":"120","is_end":false,"show_remoterec":true}]}'
const content = fs.readFileSync(path.resolve(__dirname, './__data__/content.json'), 'utf8')
it('can generate valid url', () => {
const result = url({ date, channel })
@@ -44,7 +45,7 @@ it('can handle empty guide', () => {
const result = parser({
date,
channel,
content: '{"120_200_3_20220114":[]}'
content: fs.readFileSync(path.resolve(__dirname, './__data__/no_content.json'), 'utf8')
})
expect(result).toMatchObject([])
})