Update index.test.js

This commit is contained in:
Aleksandr Statciuk 2021-10-06 16:38:22 +03:00
parent de3dc7f2ad
commit 847ab0c1ab
1 changed files with 13 additions and 15 deletions

View File

@ -25,23 +25,21 @@ it('can grab single channel programs', done => {
lang: 'fr',
name: '1TV'
}
grabber.grab(channel, config, result => {
result.on('data', function (data) {
console.log(
` ${data.channel.site} - ${data.channel.xmltv_id} - ${data.date.format('MMM D, YYYY')} (${
data.programs.length
} programs)`
)
grabber
.grab(channel, config, (data, err) => {
if (err) {
console.log(` Error: ${err.message}`)
done()
} else {
console.log(
` ${data.channel.site} - ${data.channel.xmltv_id} - ${data.date.format(
'MMM D, YYYY'
)} (${data.programs.length} programs)`
)
}
})
result.on('error', function (err) {
console.log(` Error: ${err.message}`)
done()
})
result.on('done', function (programs) {
.then(programs => {
expect(programs.length).toBe(0)
done()
})
})
})