2025-03-15 07:29:59 +03:00
|
|
|
import { execSync } from 'child_process'
|
|
|
|
|
|
|
|
|
|
type ExecError = {
|
|
|
|
|
status: number
|
|
|
|
|
stdout: string
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
it('shows an error if the playlist contains a broken link', () => {
|
|
|
|
|
try {
|
2025-03-29 11:39:30 +03:00
|
|
|
execSync('ROOT_DIR=tests/__data__/input npm run playlist:test playlist_test/ag.m3u', {
|
2025-03-15 07:29:59 +03:00
|
|
|
encoding: 'utf8'
|
|
|
|
|
})
|
|
|
|
|
process.exit(1)
|
|
|
|
|
} catch (error) {
|
|
|
|
|
expect((error as ExecError).status).toBe(1)
|
2025-03-29 11:39:30 +03:00
|
|
|
expect((error as ExecError).stdout).toContain('playlist_test/ag.m3u')
|
2025-03-15 07:29:59 +03:00
|
|
|
expect((error as ExecError).stdout).toContain('2 problems (1 errors, 1 warnings)')
|
|
|
|
|
}
|
|
|
|
|
})
|