mirror of
https://github.com/iptv-org/iptv-org.github.io.git
synced 2025-05-11 01:20:06 -04:00
Create playlistCreator.test.js
This commit is contained in:
parent
45a95b68af
commit
09b07e9b24
1 changed files with 30 additions and 0 deletions
30
tests/core/playlistCreator.test.js
Normal file
30
tests/core/playlistCreator.test.js
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
import { PlaylistCreator } from '../../src/core/playlistCreator'
|
||||||
|
import { expect, it, describe } from 'vitest'
|
||||||
|
import path from 'path'
|
||||||
|
import fs from 'fs'
|
||||||
|
import { DataProcessor } from '../../src/core'
|
||||||
|
|
||||||
|
describe('PlaylistCreator', () => {
|
||||||
|
it('can create playlist', () => {
|
||||||
|
const dataProcessor = new DataProcessor()
|
||||||
|
const { streams } = dataProcessor.process({
|
||||||
|
streams: loadJson('streams.json'),
|
||||||
|
channels: loadJson('channels.json'),
|
||||||
|
feeds: loadJson('feeds.json'),
|
||||||
|
categories: loadJson('categories.json')
|
||||||
|
})
|
||||||
|
|
||||||
|
const creator = new PlaylistCreator()
|
||||||
|
const playlist = creator.create(streams)
|
||||||
|
|
||||||
|
expect(playlist.toString()).toBe(`#EXTM3U
|
||||||
|
#EXTINF:-1 tvg-id="XtremaCartoons.ar@SD" tvg-logo="https://i.imgur.com/X2d8y4e.png" group-title="Animation;Kids" user-agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36" referrer="https://xtrematv.com/?p=1390",Xtrema Cartoons SD
|
||||||
|
#EXTVLCOPT:http-user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36
|
||||||
|
#EXTVLCOPT:http-referrer=https://xtrematv.com/?p=1390
|
||||||
|
https://stmv6.voxtvhd.com.br/xtremacartoons/xtremacartoons/playlist.m3u8`)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
function loadJson(filepath) {
|
||||||
|
return JSON.parse(fs.readFileSync(path.resolve('tests/__data__/input/', filepath), 'utf8'))
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue