mirror of
https://github.com/iptv-org/epg
synced 2026-05-08 02:16:59 -04:00
Update tvplus.com.tr.test.js
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
const { parser, url } = require('./tvplus.com.tr.config.js')
|
||||
const { parser, url, request } = require('./tvplus.com.tr.config.js')
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
const axios = require('axios')
|
||||
@@ -11,12 +11,8 @@ dayjs.extend(utc)
|
||||
|
||||
jest.mock('axios')
|
||||
|
||||
const date = dayjs.utc('2024-12-15', 'YYYY-MM-DD').startOf('d')
|
||||
const channel = {
|
||||
lang: 'tr',
|
||||
site_id: 'nick-jr/4353',
|
||||
xmltv_id: 'NickJr.tr'
|
||||
}
|
||||
const date = dayjs.utc('2026-04-22', 'YYYY-MM-DD').startOf('d')
|
||||
const channel = { site_id: '32' }
|
||||
|
||||
axios.get.mockImplementation(url => {
|
||||
if (url === 'https://tvplus.com.tr/canli-tv/yayin-akisi') {
|
||||
@@ -27,43 +23,59 @@ axios.get.mockImplementation(url => {
|
||||
})
|
||||
|
||||
it('can generate valid url', async () => {
|
||||
expect(await url({ channel })).toBe(
|
||||
'https://tvplus.com.tr/_next/data/kUzvz_bbQJNaShlFUkrR3/tr/canli-tv/yayin-akisi/nick-jr--4353.json?title=nick-jr--4353'
|
||||
)
|
||||
expect(url).toBe('https://izmaottvsc14.tvplus.com.tr:33207/EPG/JSON/PlayBillList')
|
||||
})
|
||||
|
||||
it('can generate valid request method', async () => {
|
||||
expect(request.method).toBe('POST')
|
||||
})
|
||||
|
||||
it('can generate valid request headers', async () => {
|
||||
expect(request.headers).toMatchObject({
|
||||
cookie: 'JSESSIONID=05DH3LSUA0W04YMLSYEWK3TRYY1QMBMY;'
|
||||
})
|
||||
})
|
||||
|
||||
it('can generate valid request data', async () => {
|
||||
expect(request.data({ channel, date })).toMatchObject({
|
||||
type: '2',
|
||||
channelid: '32',
|
||||
begintime: '20260422000000',
|
||||
endtime: '20260423000000',
|
||||
isFillProgram: 1
|
||||
})
|
||||
})
|
||||
|
||||
it('can parse response', () => {
|
||||
const content = fs.readFileSync(path.join(__dirname, '__data__', 'content.json'))
|
||||
const results = parser({ date, channel, content }).map(p => {
|
||||
const results = parser({ content }).map(p => {
|
||||
p.start = p.start.toJSON()
|
||||
p.stop = p.stop.toJSON()
|
||||
return p
|
||||
})
|
||||
|
||||
expect(results.length).toBe(88)
|
||||
expect(results.length).toBe(18)
|
||||
expect(results[0]).toMatchObject({
|
||||
start: '2024-12-14T21:10:00.000Z',
|
||||
stop: '2024-12-14T21:20:00.000Z',
|
||||
title: 'Camgöz (2020)',
|
||||
start: '2026-04-21T23:30:00.000Z',
|
||||
stop: '2026-04-22T01:15:00.000Z',
|
||||
title: 'Bu Ülke',
|
||||
description:
|
||||
"Max'in Camgöz adında yarı köpek balığı yarı köpek eşsiz bir evcil havyanı vardır. İlk başlarda Camgöz'ü saklamaya çalışsa da Sisli Pınarlar'da, en iyi arkadaşlar, meraklı komşular ve hatta Max'in ailesi bile yaramaz yeni arkadaşını fark edecektir.",
|
||||
"Türkiye'nin gündemindeki merak edilen ve tartışılan sorular, siyaset, ekonomi, toplumsal meseleler ve kültür-eğitim başlıklarıyla ele alınıyor. Uzman konuklar ve sahadan aktarılan bilgilerle olayların arka planı izleyiciye aktarılıyor.",
|
||||
icon: 'https://izmaottvsc14.tvplus.com.tr:33207/CPS/images/universal/film/program/202604/20260414/0/0005330799055eb7f426.jpg',
|
||||
image:
|
||||
'https://gbzeottvsc01.tvplus.com.tr:33207/CPS/images/universal/film/program/202412/20241209/21/2126356250845eb88428_0_XL.jpg',
|
||||
category: 'Çocuk',
|
||||
season: 1,
|
||||
episode: 116
|
||||
'https://izmaottvsc14.tvplus.com.tr:33207/CPS/images/universal/film/program/202604/20260414/10/0005330799045eb7f426.jpg',
|
||||
category: 'Haber'
|
||||
})
|
||||
expect(results[10]).toMatchObject({
|
||||
start: '2024-12-14T23:00:00.000Z',
|
||||
stop: '2024-12-14T23:25:00.000Z',
|
||||
title: 'Blaze ve Yol Canavarları',
|
||||
expect(results[17]).toMatchObject({
|
||||
start: '2026-04-22T23:00:00.000Z',
|
||||
stop: '2026-04-23T01:15:00.000Z',
|
||||
title: 'Açık Görüş',
|
||||
description:
|
||||
'Blaze ve Yol Canavarları, dünyanın en büyük canavar kamyonu Blaze ve en iyi arkadaşı ve sürücüsü AJ adında bir çocuk hakkındaki interaktif bir anaokulu animasyon dizisidir.',
|
||||
'Açık Görüş, farklı alanlardan uzman konukları ağırlayarak, güncel politika, ekonomi, kültür ve toplumsal meseleleri kapsamlı bir şekilde ele alan bilgilendirici bir programdır. Tartışmalar, izleyicilere olayları çok yönlü değerlendirme imkânı sunar.',
|
||||
icon: 'https://izmaottvsc14.tvplus.com.tr:33207/CPS/images/universal/film/program/202604/20260418/58/0905279525125eb9b42e.jpg',
|
||||
image:
|
||||
'https://gbzeottvsc01.tvplus.com.tr:33207/CPS/images/universal/film/program/202412/20241209/94/2126356271145eb88428_0_XL.jpg',
|
||||
category: 'Çocuk',
|
||||
season: 6,
|
||||
episode: 617
|
||||
'https://izmaottvsc14.tvplus.com.tr:33207/CPS/images/universal/film/program/202604/20260418/44/0905279525115eb9b42e.jpg',
|
||||
category: 'Magazin'
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user