mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 00:50:09 -04:00
Update update-api.test.js
This commit is contained in:
parent
c1a2991878
commit
627792d45c
1 changed files with 1 additions and 18 deletions
|
@ -5,23 +5,13 @@ const { execSync } = require('child_process')
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
fs.rmdirSync('tests/__data__/output', { recursive: true })
|
fs.rmdirSync('tests/__data__/output', { recursive: true })
|
||||||
fs.mkdirSync('tests/__data__/output')
|
fs.mkdirSync('tests/__data__/output')
|
||||||
fs.mkdirSync('tests/__data__/temp/database', { recursive: true })
|
|
||||||
fs.copyFileSync('tests/__data__/input/database/queue.db', 'tests/__data__/temp/database/queue.db')
|
|
||||||
fs.copyFileSync(
|
|
||||||
'tests/__data__/input/database/programs.db',
|
|
||||||
'tests/__data__/temp/database/programs.db'
|
|
||||||
)
|
|
||||||
|
|
||||||
const stdout = execSync(
|
const stdout = execSync(
|
||||||
'DB_DIR=tests/__data__/temp/database API_DIR=tests/__data__/output/api node scripts/commands/update-api.js',
|
'CHANNELS_PATH=tests/__data__/input/sites/**.channels.xml OUTPUT_DIR=tests/__data__/output/api node scripts/commands/update-api.js',
|
||||||
{ encoding: 'utf8' }
|
{ encoding: 'utf8' }
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
afterEach(() => {
|
|
||||||
fs.rmdirSync('tests/__data__/temp', { recursive: true })
|
|
||||||
})
|
|
||||||
|
|
||||||
it('can generate guides.json', () => {
|
it('can generate guides.json', () => {
|
||||||
const output = content('tests/__data__/output/api/guides.json')
|
const output = content('tests/__data__/output/api/guides.json')
|
||||||
const expected = content('tests/__data__/expected/api/guides.json')
|
const expected = content('tests/__data__/expected/api/guides.json')
|
||||||
|
@ -29,13 +19,6 @@ it('can generate guides.json', () => {
|
||||||
expect(output).toBe(expected)
|
expect(output).toBe(expected)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('can generate programs.json', () => {
|
|
||||||
const output = content('tests/__data__/output/api/programs.json')
|
|
||||||
const expected = content('tests/__data__/expected/api/programs.json')
|
|
||||||
|
|
||||||
expect(output).toBe(expected)
|
|
||||||
})
|
|
||||||
|
|
||||||
function content(filepath) {
|
function content(filepath) {
|
||||||
const data = fs.readFileSync(path.resolve(filepath), {
|
const data = fs.readFileSync(path.resolve(filepath), {
|
||||||
encoding: 'utf8'
|
encoding: 'utf8'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue