Fix errors found by linter

This commit is contained in:
freearhey
2023-09-22 06:22:47 +03:00
parent d2318c80d3
commit 35d2d83026
24 changed files with 632 additions and 629 deletions

View File

@@ -4,14 +4,14 @@ import fs from 'fs-extra'
beforeEach(() => {
fs.emptyDirSync('tests/__data__/output')
const stdout = execSync(
execSync(
'STREAMS_DIR=tests/__data__/input/streams_generate API_DIR=tests/__data__/output/.api npm run api:generate',
{ encoding: 'utf8' }
)
})
it('can create streams.json', () => {
expect(content(`output/.api/streams.json`)).toMatchObject(content(`expected/.api/streams.json`))
expect(content('output/.api/streams.json')).toMatchObject(content('expected/.api/streams.json'))
})
function content(filepath: string) {

View File

@@ -8,7 +8,7 @@ beforeEach(() => {
})
it('can format playlists', () => {
const stdout = execSync('STREAMS_DIR=tests/__data__/output/streams npm run playlist:format', {
execSync('STREAMS_DIR=tests/__data__/output/streams npm run playlist:format', {
encoding: 'utf8'
})

View File

@@ -5,7 +5,7 @@ import * as glob from 'glob'
beforeEach(() => {
fs.emptyDirSync('tests/__data__/output')
const stdout = execSync(
execSync(
'STREAMS_DIR=tests/__data__/input/streams_generate DATA_DIR=tests/__data__/input/data PUBLIC_DIR=tests/__data__/output/.gh-pages LOGS_DIR=tests/__data__/output/logs npm run playlist:generate',
{ encoding: 'utf8' }
)
@@ -20,8 +20,8 @@ it('can generate playlists and logs', () => {
expect(content(`output/${filepath}`), filepath).toBe(content(`expected/${filepath}`))
})
expect(content(`output/logs/generators.log`).split('\n').sort()).toStrictEqual(
content(`expected/logs/generators.log`).split('\n').sort()
expect(content('output/logs/generators.log').split('\n').sort()).toStrictEqual(
content('expected/logs/generators.log').split('\n').sort()
)
})

View File

@@ -26,7 +26,7 @@ it('can format playlists', () => {
})
expect(stdout).toBe(
`OUTPUT=closes #14151, closes #14140, closes #14139, closes #14110, closes #14179, closes #14178\n`
'OUTPUT=closes #14151, closes #14140, closes #14139, closes #14110, closes #14179, closes #14178\n'
)
})

View File

@@ -10,11 +10,13 @@ it('show an error if channel name in the blocklist', () => {
)
console.log(stdout)
process.exit(1)
} catch (error: any) {
} catch (error: unknown) {
// @ts-ignore
expect(error.status).toBe(1)
expect(
// @ts-ignore
error.stdout.includes(
`us_blocked.m3u\n 2 error "Fox Sports 2 Asia (Thai)" is on the blocklist due to claims of copyright holders (https://github.com/iptv-org/iptv/issues/0000)\n\n1 problems (1 errors, 0 warnings)\n`
'us_blocked.m3u\n 2 error "Fox Sports 2 Asia (Thai)" is on the blocklist due to claims of copyright holders (https://github.com/iptv-org/iptv/issues/0000)\n\n1 problems (1 errors, 0 warnings)\n'
)
).toBe(true)
}
@@ -30,7 +32,7 @@ it('show a warning if channel has wrong id', () => {
expect(
stdout.includes(
`wrong_id.m3u\n 2 warning "qib22lAq1L.us" is not in the database\n\n1 problems (0 errors, 1 warnings)\n`
'wrong_id.m3u\n 2 warning "qib22lAq1L.us" is not in the database\n\n1 problems (0 errors, 1 warnings)\n'
)
).toBe(true)
})

View File

@@ -14,7 +14,7 @@ beforeEach(() => {
'tests/__data__/output/.readme/template.md'
)
const stdout = execSync(
execSync(
'DATA_DIR=tests/__data__/input/data LOGS_DIR=tests/__data__/input/logs README_DIR=tests/__data__/output/.readme npm run readme:update',
{ encoding: 'utf8' }
)