Fixes channels:editor script

This commit is contained in:
freearhey 2023-10-15 10:25:55 +03:00
parent 11856161c2
commit 6e2cc42bc6
5 changed files with 23 additions and 7 deletions

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<channels>
<channel site="example.com" lang="" xmltv_id="" site_id="140">CNN International</channel>
</channels>

View file

@ -1,6 +1,7 @@
import fs from 'fs-extra'
import { execSync } from 'child_process'
import os from 'os'
import path from 'path'
beforeEach(() => {
fs.emptyDirSync('tests/__data__/output')
@ -25,5 +26,14 @@ describe('channels:editor', () => {
expect(stdout).toContain('Overwrite')
expect(stdout).toContain('Skip')
expect(stdout).toContain("File 'tests/__data__/output/channels.xml' successfully saved")
expect(content('tests/__data__/output/channels.xml')).toEqual(
content('tests/__data__/expected/sites/channels-editor/channels-editor.channels.xml')
)
})
})
function content(filepath: string) {
return fs.readFileSync(path.resolve(filepath), {
encoding: 'utf8'
})
}