mirror of
https://github.com/iptv-org/epg
synced 2025-12-18 03:16:53 -05:00
Update update-api.test.js
This commit is contained in:
@@ -10,6 +10,10 @@ beforeEach(() => {
|
|||||||
'tests/__data__/input/database/channels.db',
|
'tests/__data__/input/database/channels.db',
|
||||||
'tests/__data__/temp/database/channels.db'
|
'tests/__data__/temp/database/channels.db'
|
||||||
)
|
)
|
||||||
|
fs.copyFileSync(
|
||||||
|
'tests/__data__/input/database/programs.db',
|
||||||
|
'tests/__data__/temp/database/programs.db'
|
||||||
|
)
|
||||||
|
|
||||||
execSync(
|
execSync(
|
||||||
'DB_DIR=tests/__data__/temp/database API_DIR=tests/__data__/output/api node scripts/commands/update-api.js',
|
'DB_DIR=tests/__data__/temp/database API_DIR=tests/__data__/output/api node scripts/commands/update-api.js',
|
||||||
@@ -28,6 +32,13 @@ it('can generate channels.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'
|
||||||
|
|||||||
Reference in New Issue
Block a user