mirror of
https://github.com/iptv-org/iptv.git
synced 2026-11-19 06:40:12 +02:00
Test ordering after edits and removals
This commit is contained in:
@@ -13,6 +13,31 @@ beforeEach(() => {
|
||||
})
|
||||
|
||||
describe('playlist:update', () => {
|
||||
it('sorts edited and removed playlists without losing entries or playback options', () => {
|
||||
const entries = [
|
||||
'#EXTINF:-1 tvg-id="",Zulu (720p)',
|
||||
'https://example.com/zulu.m3u8',
|
||||
'#EXTINF:-1 tvg-id="",Alpha (720p)',
|
||||
'#EXTVLCOPT:http-referrer=https://example.com/',
|
||||
'https://example.com/alpha.m3u8',
|
||||
''
|
||||
].join('\r\n')
|
||||
for (const country of ['cy', 'br_example']) {
|
||||
fs.appendFileSync(`tests/__data__/output/streams/${country}.m3u`, entries)
|
||||
}
|
||||
|
||||
execSync(`${ENV_VAR} npm run playlist:update --silent`, { encoding: 'utf8' })
|
||||
for (const country of ['cy', 'br_example']) {
|
||||
const output = content(`tests/__data__/output/streams/${country}.m3u`)
|
||||
expect(output.indexOf(',Alpha (720p)')).toBeLessThan(output.indexOf(',Zulu (720p)'))
|
||||
expect(output).toContain('#EXTVLCOPT:http-referrer=https://example.com/')
|
||||
expect(output).toContain('https://example.com/alpha.m3u8')
|
||||
expect(output).toContain('https://example.com/zulu.m3u8')
|
||||
}
|
||||
expect(content('tests/__data__/output/streams/cy.m3u')).toContain(',AdaTV')
|
||||
expect(content('tests/__data__/output/streams/br_example.m3u')).toContain(',BBC America')
|
||||
})
|
||||
|
||||
it('leaves the order of unrelated playlists unchanged', () => {
|
||||
const filepath = 'tests/__data__/output/streams/zz.m3u'
|
||||
const original = [
|
||||
|
||||
Reference in New Issue
Block a user