Update index.test.js
This commit is contained in:
parent
769717c030
commit
37ac22eae1
|
@ -2,7 +2,7 @@
|
||||||
* @jest-environment node
|
* @jest-environment node
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { EPGGrabber } from '../src/index'
|
import { EPGGrabber, Channel } from '../src/index'
|
||||||
import axios from 'axios'
|
import axios from 'axios'
|
||||||
|
|
||||||
jest.mock('axios')
|
jest.mock('axios')
|
||||||
|
@ -20,13 +20,13 @@ it('return "Connection timeout" error if server does not response', done => {
|
||||||
},
|
},
|
||||||
parser: () => []
|
parser: () => []
|
||||||
}
|
}
|
||||||
const channel = {
|
const channel = new Channel({
|
||||||
site: 'example.com',
|
site: 'example.com',
|
||||||
site_id: 'cnn',
|
site_id: 'cnn',
|
||||||
xmltv_id: 'CNN.us',
|
xmltv_id: 'CNN.us',
|
||||||
lang: 'en',
|
lang: 'en',
|
||||||
name: 'CNN'
|
name: 'CNN'
|
||||||
}
|
})
|
||||||
const grabber = new EPGGrabber(config)
|
const grabber = new EPGGrabber(config)
|
||||||
grabber.grab(channel, '2022-01-01', (data, err) => {
|
grabber.grab(channel, '2022-01-01', (data, err) => {
|
||||||
expect(err.message).toBe('Connection timeout')
|
expect(err.message).toBe('Connection timeout')
|
||||||
|
@ -47,13 +47,13 @@ it('can grab single channel programs', done => {
|
||||||
url: 'http://example.com/20210319/1tv.json',
|
url: 'http://example.com/20210319/1tv.json',
|
||||||
parser: () => []
|
parser: () => []
|
||||||
}
|
}
|
||||||
const channel = {
|
const channel = new Channel({
|
||||||
site: 'example.com',
|
site: 'example.com',
|
||||||
site_id: '1',
|
site_id: '1',
|
||||||
xmltv_id: '1TV.fr',
|
xmltv_id: '1TV.fr',
|
||||||
lang: 'fr',
|
lang: 'fr',
|
||||||
name: '1TV'
|
name: '1TV'
|
||||||
}
|
})
|
||||||
const grabber = new EPGGrabber(config)
|
const grabber = new EPGGrabber(config)
|
||||||
grabber
|
grabber
|
||||||
.grab(channel, '2022-01-01', (data, err) => {
|
.grab(channel, '2022-01-01', (data, err) => {
|
||||||
|
|
Loading…
Reference in New Issue