mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 00:50:09 -04:00
wip
This commit is contained in:
parent
d068f5083f
commit
557a05ddac
13 changed files with 3046 additions and 142057 deletions
|
@ -7,13 +7,13 @@ beforeEach(() => {
|
|||
fs.mkdirSync('tests/__data__/output')
|
||||
})
|
||||
|
||||
it('can create database', () => {
|
||||
it('can create channels database', () => {
|
||||
const results = execSync(
|
||||
'DB_FILEPATH=tests/__data__/output/test.db node scripts/commands/create-database.js --channels=tests/__data__/input/site.channels.xml --max-clusters=1',
|
||||
'DB_DIR=tests/__data__/output/database node scripts/commands/create-database.js --channels=tests/__data__/input/site.channels.xml --max-clusters=1',
|
||||
{ encoding: 'utf8' }
|
||||
)
|
||||
|
||||
const database = fs.readFileSync(path.resolve('tests/__data__/output/test.db'), {
|
||||
const database = fs.readFileSync(path.resolve('tests/__data__/output/database/channels.db'), {
|
||||
encoding: 'utf8'
|
||||
})
|
||||
const item = database.split('\n').find(i => i.includes('AndorraTV.ad'))
|
||||
|
|
|
@ -5,7 +5,7 @@ const { execSync } = require('child_process')
|
|||
beforeEach(() => {
|
||||
fs.rmdirSync('tests/__data__/output', { recursive: true })
|
||||
fs.mkdirSync('tests/__data__/output')
|
||||
fs.copyFileSync('tests/__data__/input/test.db', 'tests/__data__/temp/test.db')
|
||||
fs.copyFileSync('tests/__data__/input/channels.db', 'tests/__data__/temp/channels.db')
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
|
@ -15,7 +15,7 @@ afterEach(() => {
|
|||
|
||||
it('can load cluster', () => {
|
||||
const result = execSync(
|
||||
'DB_FILEPATH=tests/__data__/temp/test.db LOGS_PATH=tests/__data__/output/logs node scripts/commands/load-cluster.js --cluster-id=1',
|
||||
'DB_DIR=tests/__data__/temp LOGS_PATH=tests/__data__/output/logs node scripts/commands/load-cluster.js --cluster-id=1',
|
||||
{ encoding: 'utf8' }
|
||||
)
|
||||
const logs = fs.readFileSync(
|
||||
|
@ -26,11 +26,5 @@ it('can load cluster', () => {
|
|||
)
|
||||
const lines = logs.split('\n')
|
||||
const parsed = JSON.parse(lines[0])
|
||||
expect(parsed['K1kaxwsWVjsRIZL6'][0]).toMatchObject({
|
||||
title: 'InfoNeu ',
|
||||
start: '2022-01-06T07:00:00.000Z',
|
||||
stop: '2022-01-06T08:00:00.000Z',
|
||||
channel: 'AndorraTV.ad',
|
||||
lang: 'ca'
|
||||
})
|
||||
expect(parsed._id).toBe('K1kaxwsWVjsRIZL6')
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue