mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-09 16:40:07 -04:00
Fix guides/update.test.js
This commit is contained in:
parent
ede1548475
commit
42e40b89f5
2 changed files with 3 additions and 3 deletions
|
@ -3,6 +3,7 @@ const grabber = require('epg-grabber')
|
||||||
const _ = require('lodash')
|
const _ = require('lodash')
|
||||||
|
|
||||||
const PUBLIC_DIR = process.env.PUBLIC_DIR || '.gh-pages'
|
const PUBLIC_DIR = process.env.PUBLIC_DIR || '.gh-pages'
|
||||||
|
const CURR_DATE = process.env.CURR_DATE || new Date()
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
logger.info(`Generating guides/...`)
|
logger.info(`Generating guides/...`)
|
||||||
|
@ -40,7 +41,7 @@ async function main() {
|
||||||
|
|
||||||
const filepath = `${PUBLIC_DIR}/guides/${key}.epg.xml`
|
const filepath = `${PUBLIC_DIR}/guides/${key}.epg.xml`
|
||||||
logger.info(`Creating "${filepath}"...`)
|
logger.info(`Creating "${filepath}"...`)
|
||||||
const output = grabber.convertToXMLTV({ channels, programs })
|
const output = grabber.convertToXMLTV({ channels, programs, date: CURR_DATE })
|
||||||
await file.create(filepath, output)
|
await file.create(filepath, output)
|
||||||
const compressed = await zip.compress(output)
|
const compressed = await zip.compress(output)
|
||||||
await file.create(filepath + '.gz', compressed)
|
await file.create(filepath + '.gz', compressed)
|
||||||
|
|
|
@ -17,7 +17,7 @@ it('can generate /guides', () => {
|
||||||
'tests/__data__/output/programs.db'
|
'tests/__data__/output/programs.db'
|
||||||
)
|
)
|
||||||
const stdout = execSync(
|
const stdout = execSync(
|
||||||
'DB_DIR=tests/__data__/output DATA_DIR=tests/__data__/input/data PUBLIC_DIR=tests/__data__/output npm run guides:update',
|
'DB_DIR=tests/__data__/output DATA_DIR=tests/__data__/input/data PUBLIC_DIR=tests/__data__/output CURR_DATE=2022-05-05 npm run guides:update',
|
||||||
{ encoding: 'utf8' }
|
{ encoding: 'utf8' }
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -48,7 +48,6 @@ it('will terminate process if programs not found', () => {
|
||||||
'DB_DIR=tests/__data__/output DATA_DIR=tests/__data__/input/data PUBLIC_DIR=tests/__data__/output npm run guides:update',
|
'DB_DIR=tests/__data__/output DATA_DIR=tests/__data__/input/data PUBLIC_DIR=tests/__data__/output npm run guides:update',
|
||||||
{ encoding: 'utf8' }
|
{ encoding: 'utf8' }
|
||||||
)
|
)
|
||||||
console.log(stdout)
|
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
expect(err.status).toBe(1)
|
expect(err.status).toBe(1)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue