mirror of
https://github.com/iptv-org/epg.git
synced 2025-05-10 09:00:07 -04:00
Update save-results.js
This commit is contained in:
parent
642b09051f
commit
15e54da0e2
4 changed files with 41 additions and 17 deletions
|
@ -12,38 +12,50 @@ beforeEach(() => {
|
|||
'tests/__data__/output/database/channels.db'
|
||||
)
|
||||
|
||||
execSync(
|
||||
const stdout = execSync(
|
||||
'DB_DIR=tests/__data__/output/database LOGS_DIR=tests/__data__/input/logs node scripts/commands/save-results.js',
|
||||
{ encoding: 'utf8' }
|
||||
)
|
||||
console.log(stdout)
|
||||
})
|
||||
|
||||
it('can save results to database', () => {
|
||||
const output = content('tests/__data__/output/database/programs.db')
|
||||
it('can save results', () => {
|
||||
const programs = content('tests/__data__/output/database/programs.db')
|
||||
|
||||
expect(Object.keys(output[0]).sort()).toEqual([
|
||||
expect(Object.keys(programs[0]).sort()).toEqual([
|
||||
'_cid',
|
||||
'_id',
|
||||
'category',
|
||||
'channel',
|
||||
'country',
|
||||
'description',
|
||||
'episode',
|
||||
'gid',
|
||||
'icon',
|
||||
'lang',
|
||||
'season',
|
||||
'site',
|
||||
'start',
|
||||
'stop',
|
||||
'title'
|
||||
])
|
||||
|
||||
const database = content('tests/__data__/output/database/channels.db')
|
||||
expect(programs[0]).toMatchObject({
|
||||
_cid: '0Wefq0oMR3feCcuY'
|
||||
})
|
||||
|
||||
expect(database[1]).toMatchObject({
|
||||
const channels = content('tests/__data__/output/database/channels.db')
|
||||
|
||||
expect(channels[1]).toMatchObject({
|
||||
_id: '0Wefq0oMR3feCcuY',
|
||||
logo: 'https://example.com/logo.png'
|
||||
})
|
||||
|
||||
const errors = content('tests/__data__/input/logs/errors.log')
|
||||
|
||||
expect(errors[0]).toMatchObject({
|
||||
_id: '00AluKCrCnfgrl8W',
|
||||
site: 'directv.com',
|
||||
xmltv_id: 'BravoEast.us',
|
||||
error: 'Invalid header value char'
|
||||
})
|
||||
})
|
||||
|
||||
function content(filepath) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue