mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 00:50:09 -04:00
Create update.test.js
This commit is contained in:
parent
84ce9185a7
commit
fe1ab9f2e1
1 changed files with 26 additions and 0 deletions
26
tests/commands/status/update.test.js
Normal file
26
tests/commands/status/update.test.js
Normal file
|
@ -0,0 +1,26 @@
|
|||
const { execSync } = require('child_process')
|
||||
const fs = require('fs-extra')
|
||||
const path = require('path')
|
||||
|
||||
beforeEach(() => {
|
||||
fs.emptyDirSync('tests/__data__/output')
|
||||
|
||||
const stdout = execSync(
|
||||
'CONFIGS_PATH=tests/__data__/input/sites/example.com.config.js DATA_DIR=tests/__data__/input/data npm run status:update -- --config=tests/__data__/input/status.json',
|
||||
{ encoding: 'utf8' }
|
||||
)
|
||||
})
|
||||
|
||||
it('can update status.md', () => {
|
||||
expect(content('tests/__data__/output/status.md')).toBe(
|
||||
content('tests/__data__/expected/_status.md')
|
||||
)
|
||||
})
|
||||
|
||||
function content(filepath) {
|
||||
const data = fs.readFileSync(path.resolve(filepath), {
|
||||
encoding: 'utf8'
|
||||
})
|
||||
|
||||
return JSON.stringify(data)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue