Sort internal playlists after stream updates

This commit is contained in:
Zair Leon committed 2026-11-16 18:31:55 -06:00
1 parent 323d86a002
commit 45e2cab1e9
5 files changed
+49 -12

No files matched your search

+20
View File
@@ -13,6 +13,21 @@ beforeEach(() => {
})
describe('playlist:update', () => {
it('leaves the order of unrelated playlists unchanged', () => {
const filepath = 'tests/__data__/output/streams/zz.m3u'
const original = [
'#EXTM3U',
'#EXTINF:-1 tvg-id="",Zulu (720p)',
'https://example.com/zulu.m3u8',
'#EXTINF:-1 tvg-id="",Alpha (720p)',
'https://example.com/alpha.m3u8',
''
].join('\r\n')
fs.writeFileSync(filepath, original)
execSync(`${ENV_VAR} npm run playlist:update --silent`, { encoding: 'utf8' })
expect(content(filepath)).toBe(original)
})
it('can update playlists', async () => {
let cmd = `${ENV_VAR} npm run playlist:update`
if (!process.env.DEBUG) cmd += ' --silent'
@@ -36,6 +51,11 @@ describe('playlist:update', () => {
)
})
const uk = content('tests/__data__/output/streams/uk.m3u')
expect(uk.indexOf(',BBC News')).toBeLessThan(uk.indexOf(',Beano TV'))
expect(uk.indexOf(',Beano TV')).toBeLessThan(uk.indexOf(',Fox Sports'))
expect(uk).toContain('|Referer="https://referer.xyz/"|User-Agent=')
expect(content('tests/__data__/output/logs/playlist_update.log')).toBe(
content('tests/__data__/expected/playlist_update/playlist_update.log')
)