mirror of
https://github.com/iptv-org/epg
synced 2025-12-17 10:56:57 -05:00
wip
This commit is contained in:
@@ -5,11 +5,20 @@ 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/channels.db',
|
||||||
|
'tests/__data__/temp/database/channels.db'
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
fs.rmdirSync('tests/__data__/temp', { recursive: true })
|
||||||
})
|
})
|
||||||
|
|
||||||
it('can create valid matrix', () => {
|
it('can create valid matrix', () => {
|
||||||
const result = execSync(
|
const result = execSync(
|
||||||
'DB_DIR=tests/__data__/input/database node scripts/commands/create-matrix.js',
|
'DB_DIR=tests/__data__/temp/database node scripts/commands/create-matrix.js',
|
||||||
{
|
{
|
||||||
encoding: 'utf8'
|
encoding: 'utf8'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,13 +5,22 @@ 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/channels.db',
|
||||||
|
'tests/__data__/temp/database/channels.db'
|
||||||
|
)
|
||||||
|
|
||||||
execSync(
|
execSync(
|
||||||
'PUBLIC_DIR=tests/__data__/output DB_DIR=tests/__data__/input/database node scripts/commands/generate-guides.js',
|
'DB_DIR=tests/__data__/temp/database PUBLIC_DIR=tests/__data__/output node scripts/commands/generate-guides.js',
|
||||||
{ encoding: 'utf8' }
|
{ encoding: 'utf8' }
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
fs.rmdirSync('tests/__data__/temp', { recursive: true })
|
||||||
|
})
|
||||||
|
|
||||||
it('can generate channels.json', () => {
|
it('can generate channels.json', () => {
|
||||||
const output = content('tests/__data__/output/api/channels.json')
|
const output = content('tests/__data__/output/api/channels.json')
|
||||||
const expected = content('tests/__data__/expected/api/channels.json')
|
const expected = content('tests/__data__/expected/api/channels.json')
|
||||||
|
|||||||
@@ -5,13 +5,22 @@ 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/channels.db',
|
||||||
|
'tests/__data__/temp/database/channels.db'
|
||||||
|
)
|
||||||
|
|
||||||
execSync(
|
execSync(
|
||||||
'DB_DIR=tests/__data__/input/database LOGS_DIR=tests/__data__/output/logs node scripts/commands/load-cluster.js --cluster-id=1',
|
'DB_DIR=tests/__data__/temp/database LOGS_DIR=tests/__data__/output/logs node scripts/commands/load-cluster.js --cluster-id=1',
|
||||||
{ encoding: 'utf8' }
|
{ encoding: 'utf8' }
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
fs.rmdirSync('tests/__data__/temp', { recursive: true })
|
||||||
|
})
|
||||||
|
|
||||||
it('can load cluster', () => {
|
it('can load cluster', () => {
|
||||||
const output = fs.readFileSync(
|
const output = fs.readFileSync(
|
||||||
path.resolve('tests/__data__/output/logs/load-cluster/cluster_1.log'),
|
path.resolve('tests/__data__/output/logs/load-cluster/cluster_1.log'),
|
||||||
|
|||||||
Reference in New Issue
Block a user