mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 00:50:09 -04:00
Move scripts to subfolders
This commit is contained in:
parent
f0c64a55e4
commit
b1a0bcf4b9
36 changed files with 204 additions and 222 deletions
38
tests/commands/guides/update.test.js
Normal file
38
tests/commands/guides/update.test.js
Normal file
|
@ -0,0 +1,38 @@
|
|||
const { execSync } = require('child_process')
|
||||
const fs = require('fs-extra')
|
||||
const path = require('path')
|
||||
|
||||
beforeEach(() => {
|
||||
fs.emptyDirSync('tests/__data__/output')
|
||||
fs.copyFileSync('tests/__data__/input/database/queue.db', 'tests/__data__/output/queue.db')
|
||||
fs.copyFileSync('tests/__data__/input/database/programs.db', 'tests/__data__/output/programs.db')
|
||||
|
||||
const stdout = execSync(
|
||||
'DB_DIR=tests/__data__/output DATA_DIR=tests/__data__/input/data PUBLIC_DIR=tests/__data__/output LOGS_DIR=tests/__data__/output/logs npm run guides:update',
|
||||
{ encoding: 'utf8' }
|
||||
)
|
||||
})
|
||||
|
||||
it('can generate /guides', () => {
|
||||
expect(content('tests/__data__/output/guides/fr/chaines-tv.orange.fr.epg.xml')).toBe(
|
||||
content('tests/__data__/expected/guides/fr/chaines-tv.orange.fr.epg.xml')
|
||||
)
|
||||
|
||||
expect(content('tests/__data__/output/guides/zw/dstv.com.epg.xml')).toBe(
|
||||
content('tests/__data__/expected/guides/zw/dstv.com.epg.xml')
|
||||
)
|
||||
})
|
||||
|
||||
it('can create guides.log', () => {
|
||||
expect(content('tests/__data__/output/logs/guides/update.log')).toBe(
|
||||
content('tests/__data__/expected/logs/guides/update.log')
|
||||
)
|
||||
})
|
||||
|
||||
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