mirror of
https://github.com/iptv-org/iptv
synced 2026-04-28 13:47:04 -04:00
Update tests
This commit is contained in:
@@ -4,15 +4,12 @@ import { glob } from 'glob'
|
||||
|
||||
beforeEach(() => {
|
||||
fs.emptyDirSync('tests/__data__/output')
|
||||
fs.copyFileSync(
|
||||
'tests/__data__/input/database/playlist_update.streams.db',
|
||||
'tests/__data__/output/streams.db'
|
||||
)
|
||||
fs.copySync('tests/__data__/input/streams_update', 'tests/__data__/output/streams')
|
||||
})
|
||||
|
||||
it('can format playlists', () => {
|
||||
const stdout = execSync(
|
||||
'DEBUG=true DATA_DIR=tests/__data__/input/data STREAMS_DIR=tests/__data__/output/streams DB_DIR=tests/__data__/output npm run playlist:update --silent',
|
||||
'DEBUG=true DATA_DIR=tests/__data__/input/data STREAMS_DIR=tests/__data__/output/streams npm run playlist:update --silent',
|
||||
{
|
||||
encoding: 'utf8'
|
||||
}
|
||||
@@ -21,11 +18,13 @@ it('can format playlists', () => {
|
||||
expect(stdout).toBe(`OUTPUT=closes #14151, closes #14110, closes #14179, closes #14178\n`)
|
||||
|
||||
const files = glob
|
||||
.sync('tests/__data__/expected/streams/*.m3u')
|
||||
.map(f => f.replace('tests/__data__/expected/', ''))
|
||||
.sync('tests/__data__/expected/streams_update/*.m3u')
|
||||
.map(f => f.replace('tests/__data__/expected/streams_update/', ''))
|
||||
|
||||
files.forEach(filepath => {
|
||||
expect(content(`output/${filepath}`), filepath).toBe(content(`expected/${filepath}`))
|
||||
expect(content(`output/streams/${filepath}`), filepath).toBe(
|
||||
content(`expected/streams_update/${filepath}`)
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user