mirror of
https://github.com/iptv-org/epg
synced 2026-05-29 04:29:22 -04:00
Update tests
This commit is contained in:
@@ -2,22 +2,24 @@ import { execSync } from 'child_process'
|
||||
import { pathToFileURL } from 'node:url'
|
||||
import fs from 'fs-extra'
|
||||
|
||||
const ENV_VAR = 'cross-env ROOT_DIR=tests/__data__/output'
|
||||
const ENV_VAR =
|
||||
'cross-env CURR_DATE=2022-10-04 ROOT_DIR=tests/__data__/output DATA_DIR=tests/__data__/input/guides_update'
|
||||
|
||||
beforeEach(() => {
|
||||
fs.emptyDirSync('tests/__data__/output')
|
||||
fs.copySync('tests/__data__/input/guides_update/workers.txt', 'tests/__data__/output/workers.txt')
|
||||
})
|
||||
|
||||
it('can update GUIDES.md', () => {
|
||||
const cmd = `${ENV_VAR} npm run guides:update`
|
||||
describe('guides:update', () => {
|
||||
it('can update GUIDES.md', () => {
|
||||
const cmd = `${ENV_VAR} npm run guides:update`
|
||||
|
||||
const stdout = execSync(cmd, { encoding: 'utf8' })
|
||||
if (process.env.DEBUG === 'true') console.log(cmd, stdout)
|
||||
const stdout = execSync(cmd, { encoding: 'utf8' })
|
||||
if (process.env.DEBUG === 'true') console.log(cmd, stdout)
|
||||
|
||||
expect(content('tests/__data__/output/GUIDES.md')).toEqual(
|
||||
content('tests/__data__/expected/guides_update/GUIDES.md')
|
||||
)
|
||||
expect(content('tests/__data__/output/GUIDES.md')).toEqual(
|
||||
content('tests/__data__/expected/guides_update/GUIDES.md')
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
function content(filepath: string) {
|
||||
|
||||
Reference in New Issue
Block a user