mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 09:00:07 -04:00
Update update-api.test.js
This commit is contained in:
parent
a49b356ff6
commit
a368667381
1 changed files with 11 additions and 0 deletions
|
@ -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'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue