mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 00:50:09 -04:00
Update update.test.ts
This commit is contained in:
parent
0f92463d05
commit
25093cb927
1 changed files with 9 additions and 6 deletions
|
@ -1,6 +1,7 @@
|
||||||
import { execSync } from 'child_process'
|
import { execSync } from 'child_process'
|
||||||
import fs from 'fs-extra'
|
import fs from 'fs-extra'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
|
import os from 'os'
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
fs.emptyDirSync('tests/__data__/output')
|
fs.emptyDirSync('tests/__data__/output')
|
||||||
|
@ -16,12 +17,14 @@ beforeEach(() => {
|
||||||
})
|
})
|
||||||
|
|
||||||
it('can update SITES.md', () => {
|
it('can update SITES.md', () => {
|
||||||
const stdout = execSync(
|
let ENV_VAR =
|
||||||
'DOT_SITES_DIR=tests/__data__/output/.sites SITES_DIR=tests/__data__/input/sites-update/sites npm run sites:update',
|
'DOT_SITES_DIR=tests/__data__/output/.sites SITES_DIR=tests/__data__/input/sites-update/sites'
|
||||||
{
|
if (os.platform() === 'win32') {
|
||||||
encoding: 'utf8'
|
ENV_VAR =
|
||||||
}
|
'SET "DOT_SITES_DIR=tests/__data__/output/.sites" && SET "SITES_DIR=tests/__data__/input/sites-update/sites" &&'
|
||||||
)
|
}
|
||||||
|
|
||||||
|
const stdout = execSync(`${ENV_VAR} npm run sites:update`, { encoding: 'utf8' })
|
||||||
if (process.env.DEBUG === 'true') console.log(stdout)
|
if (process.env.DEBUG === 'true') console.log(stdout)
|
||||||
|
|
||||||
expect(content('tests/__data__/output/sites.md')).toEqual(
|
expect(content('tests/__data__/output/sites.md')).toEqual(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue