Update index.test.js

This commit is contained in:
Aleksandr Statciuk 2022-03-29 16:00:00 +03:00
parent 3130e557b2
commit 83a0ac2ff4
1 changed files with 5 additions and 3 deletions

View File

@ -2,7 +2,7 @@
* @jest-environment node * @jest-environment node
*/ */
import grabber from '../src/index' import EPGGrabber from '../src/index'
import axios from 'axios' import axios from 'axios'
jest.mock('axios') jest.mock('axios')
@ -27,7 +27,8 @@ it('return "Connection timeout" error if server does not response', done => {
lang: 'en', lang: 'en',
name: 'CNN' name: 'CNN'
} }
grabber.grab(channel, '2022-01-01', config, (data, err) => { const grabber = new EPGGrabber(config)
grabber.grab(channel, '2022-01-01', (data, err) => {
expect(err.message).toBe('Connection timeout') expect(err.message).toBe('Connection timeout')
done() done()
}) })
@ -53,8 +54,9 @@ it('can grab single channel programs', done => {
lang: 'fr', lang: 'fr',
name: '1TV' name: '1TV'
} }
const grabber = new EPGGrabber(config)
grabber grabber
.grab(channel, '2022-01-01', config, (data, err) => { .grab(channel, '2022-01-01', (data, err) => {
if (err) { if (err) {
console.log(` Error: ${err.message}`) console.log(` Error: ${err.message}`)
done() done()