mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 00:50:09 -04:00
Update editor.test.ts
This commit is contained in:
parent
74ce0a9a2e
commit
cd15eecd5f
1 changed files with 23 additions and 11 deletions
|
@ -3,6 +3,11 @@ import { execSync } from 'child_process'
|
||||||
import os from 'os'
|
import os from 'os'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
|
|
||||||
|
type ExecError = {
|
||||||
|
status: number
|
||||||
|
stdout: string
|
||||||
|
}
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
fs.emptyDirSync('tests/__data__/output')
|
fs.emptyDirSync('tests/__data__/output')
|
||||||
fs.copySync(
|
fs.copySync(
|
||||||
|
@ -18,17 +23,24 @@ describe('channels:editor', () => {
|
||||||
ENV_VAR = 'SET "DATA_DIR=tests/__data__/input/temp/data" &&'
|
ENV_VAR = 'SET "DATA_DIR=tests/__data__/input/temp/data" &&'
|
||||||
}
|
}
|
||||||
|
|
||||||
const cmd = `${ENV_VAR} npm run channels:editor -- tests/__data__/output/channels.xml`
|
try {
|
||||||
const stdout = execSync(cmd, { encoding: 'utf8' })
|
const cmd = `${ENV_VAR} npm run channels:editor -- tests/__data__/output/channels.xml`
|
||||||
|
execSync(cmd, { encoding: 'utf8' })
|
||||||
expect(stdout).toContain('CNN International | CNNInternational.us [new]')
|
} catch (error) {
|
||||||
expect(stdout).toContain('CNN International Europe | CNNInternationalEurope.us [api]')
|
expect((error as ExecError).status).toBe(1)
|
||||||
expect(stdout).toContain('Overwrite')
|
expect((error as ExecError).stdout).toContain('CNN International | CNNInternational.us [new]')
|
||||||
expect(stdout).toContain('Skip')
|
expect((error as ExecError).stdout).toContain(
|
||||||
expect(stdout).toContain("File 'tests/__data__/output/channels.xml' successfully saved")
|
'CNN International Europe | CNNInternationalEurope.us [api]'
|
||||||
expect(content('tests/__data__/output/channels.xml')).toEqual(
|
)
|
||||||
content('tests/__data__/expected/sites/channels-editor/channels-editor.channels.xml')
|
expect((error as ExecError).stdout).toContain('Overwrite')
|
||||||
)
|
expect((error as ExecError).stdout).toContain('Skip')
|
||||||
|
expect((error as ExecError).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')
|
||||||
|
)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue