mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-09 08:30:06 -04:00
Update update.test.ts
This commit is contained in:
parent
ad80c82882
commit
3db2e6a950
1 changed files with 39 additions and 39 deletions
|
@ -1,39 +1,39 @@
|
|||
import { execSync } from 'child_process'
|
||||
import fs from 'fs-extra'
|
||||
import path from 'path'
|
||||
|
||||
beforeEach(() => {
|
||||
fs.emptyDirSync('tests/__data__/output')
|
||||
fs.mkdirSync('tests/__data__/output/.sites')
|
||||
fs.copyFileSync(
|
||||
'tests/__data__/input/.sites/config.json',
|
||||
'tests/__data__/output/.sites/config.json'
|
||||
)
|
||||
fs.copyFileSync(
|
||||
'tests/__data__/input/.sites/template.md',
|
||||
'tests/__data__/output/.sites/template.md'
|
||||
)
|
||||
})
|
||||
|
||||
it('can update SITES.md', () => {
|
||||
execSync(
|
||||
'DOT_SITES_DIR=tests/__data__/output/.sites SITES_DIR=tests/__data__/input/sites-update/sites npm run sites:update',
|
||||
{
|
||||
encoding: 'utf8'
|
||||
}
|
||||
)
|
||||
|
||||
expect(content('tests/__data__/output/sites.md')).toEqual(
|
||||
content('tests/__data__/expected/_sites.md')
|
||||
)
|
||||
|
||||
expect(true).toBe(true)
|
||||
})
|
||||
|
||||
function content(filepath: string) {
|
||||
const data = fs.readFileSync(path.resolve(filepath), {
|
||||
encoding: 'utf8'
|
||||
})
|
||||
|
||||
return JSON.stringify(data)
|
||||
}
|
||||
import { execSync } from 'child_process'
|
||||
import fs from 'fs-extra'
|
||||
import path from 'path'
|
||||
|
||||
beforeEach(() => {
|
||||
fs.emptyDirSync('tests/__data__/output')
|
||||
fs.mkdirSync('tests/__data__/output/.sites')
|
||||
fs.copyFileSync(
|
||||
'tests/__data__/input/.sites/config.json',
|
||||
'tests/__data__/output/.sites/config.json'
|
||||
)
|
||||
fs.copyFileSync(
|
||||
'tests/__data__/input/.sites/template.md',
|
||||
'tests/__data__/output/.sites/template.md'
|
||||
)
|
||||
})
|
||||
|
||||
it('can update SITES.md', () => {
|
||||
execSync(
|
||||
'DOT_SITES_DIR=tests/__data__/output/.sites SITES_DIR=tests/__data__/input/sites-update/sites npm run sites:update',
|
||||
{
|
||||
encoding: 'utf8'
|
||||
}
|
||||
)
|
||||
|
||||
expect(content('tests/__data__/output/sites.md')).toEqual(
|
||||
content('tests/__data__/expected/_sites.md')
|
||||
)
|
||||
|
||||
expect(true).toBe(true)
|
||||
})
|
||||
|
||||
function content(filepath: string) {
|
||||
const data = fs.readFileSync(path.resolve(filepath), {
|
||||
encoding: 'utf8'
|
||||
})
|
||||
|
||||
return JSON.stringify(data)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue