mirror of
https://github.com/iptv-org/iptv
synced 2025-12-17 10:57:18 -05:00
Replace LF with CRLF
This commit is contained in:
@@ -3,7 +3,8 @@ import { execSync } from 'child_process'
|
|||||||
import * as fs from 'fs-extra'
|
import * as fs from 'fs-extra'
|
||||||
import { glob } from 'glob'
|
import { glob } from 'glob'
|
||||||
|
|
||||||
const ENV_VAR = 'cross-env DATA_DIR=tests/__data__/input/data STREAMS_DIR=tests/__data__/output/streams'
|
const ENV_VAR =
|
||||||
|
'cross-env DATA_DIR=tests/__data__/input/data STREAMS_DIR=tests/__data__/output/streams'
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
fs.emptyDirSync('tests/__data__/output')
|
fs.emptyDirSync('tests/__data__/output')
|
||||||
@@ -11,27 +12,35 @@ beforeEach(() => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
describe('playlist:update', () => {
|
describe('playlist:update', () => {
|
||||||
it('can update playlists', () => {
|
it('can update playlists', done => {
|
||||||
const cmd = `${ENV_VAR} npm run playlist:update --silent`
|
let cmd = `${ENV_VAR} npm run playlist:update`
|
||||||
const stdout = execSync(cmd, { encoding: 'utf8' })
|
if (!process.env.DEBUG) cmd += ' --silent'
|
||||||
if (process.env.DEBUG === 'true') console.log(cmd, stdout)
|
try {
|
||||||
|
const stdout = execSync(cmd, { encoding: 'utf8' })
|
||||||
|
if (process.env.DEBUG === 'true') console.log(cmd, stdout)
|
||||||
|
|
||||||
const files = glob.sync('tests/__data__/expected/playlist_update/*.m3u').map(filepath => {
|
const files = glob.sync('tests/__data__/expected/playlist_update/*.m3u').map(filepath => {
|
||||||
const fileUrl = pathToFileURL(filepath).toString()
|
const fileUrl = pathToFileURL(filepath).toString()
|
||||||
const pathToRemove = pathToFileURL('tests/__data__/expected/playlist_update/').toString()
|
const pathToRemove = pathToFileURL('tests/__data__/expected/playlist_update/').toString()
|
||||||
|
|
||||||
return fileUrl.replace(pathToRemove, '')
|
return fileUrl.replace(pathToRemove, '')
|
||||||
})
|
})
|
||||||
|
|
||||||
files.forEach(filepath => {
|
files.forEach(filepath => {
|
||||||
expect(content(`tests/__data__/output/streams/${filepath}`)).toBe(
|
expect(content(`tests/__data__/output/streams/${filepath}`)).toBe(
|
||||||
content(`tests/__data__/expected/playlist_update/${filepath}`)
|
content(`tests/__data__/expected/playlist_update/${filepath}`)
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
expect(stdout).toBe(
|
||||||
|
'OUTPUT=closes #14151, closes #14150, closes #14110, closes #14120, closes #14175, closes #14105, closes #14104, closes #14057, closes #14034, closes #13964, closes #13893, closes #13881, closes #13793, closes #13751, closes #13715\n'
|
||||||
)
|
)
|
||||||
})
|
|
||||||
|
|
||||||
expect(stdout).toBe(
|
done()
|
||||||
'OUTPUT=closes #14151, closes #14150, closes #14110, closes #14120, closes #14175, closes #14105, closes #14104, closes #14057, closes #14034, closes #13964, closes #13893, closes #13881, closes #13793, closes #13751, closes #13715\n'
|
} catch (err) {
|
||||||
)
|
if (process.env.DEBUG === 'true') console.log(cmd, err.stdout)
|
||||||
|
done(err)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user