Files
epg/tests/commands/readme/update.test.js

27 lines
705 B
JavaScript
Raw Normal View History

2022-01-14 23:57:03 +03:00
const { execSync } = require('child_process')
2022-02-26 23:21:44 +03:00
const fs = require('fs-extra')
const path = require('path')
2022-01-14 23:57:03 +03:00
beforeEach(() => {
2022-02-26 23:21:44 +03:00
fs.emptyDirSync('tests/__data__/output')
2022-01-14 23:57:03 +03:00
2022-01-21 23:15:39 +03:00
const stdout = execSync(
2022-02-27 18:04:33 +03:00
'CHANNELS_PATH=tests/__data__/input/sites/example.com_ca.channels.xml DATA_DIR=tests/__data__/input/data npm run readme:update -- --config=tests/__data__/input/readme.json',
2022-01-14 23:57:03 +03:00
{ encoding: 'utf8' }
)
})
it('can update readme.md', () => {
2022-02-26 23:21:44 +03:00
expect(content('tests/__data__/output/readme.md')).toBe(
content('tests/__data__/expected/_readme.md')
)
2022-01-14 23:57:03 +03:00
})
function content(filepath) {
const data = fs.readFileSync(path.resolve(filepath), {
encoding: 'utf8'
})
return JSON.stringify(data)
}