Update utils.test.js
This commit is contained in:
parent
45df682782
commit
014bcec560
|
@ -2,13 +2,13 @@ import mockAxios from 'jest-mock-axios'
|
||||||
import utils from '../src/utils'
|
import utils from '../src/utils'
|
||||||
|
|
||||||
it('can load valid config.js', () => {
|
it('can load valid config.js', () => {
|
||||||
const config = utils.loadConfig('./tests/input/example.com.config.js')
|
const config = utils.loadConfig({ config: './tests/input/example.com.config.js' })
|
||||||
expect(config).toMatchObject({
|
expect(config).toMatchObject({
|
||||||
channels: 'tests/input/example.com.channels.xml',
|
channels: 'tests/input/example.com.channels.xml',
|
||||||
days: 1,
|
days: 1,
|
||||||
delay: 3000,
|
delay: 3000,
|
||||||
lang: 'en',
|
lang: 'en',
|
||||||
output: 'guide.xml',
|
output: 'tests/output/guide.xml',
|
||||||
site: 'example.com'
|
site: 'example.com'
|
||||||
})
|
})
|
||||||
expect(config.request).toMatchObject({
|
expect(config.request).toMatchObject({
|
||||||
|
@ -115,7 +115,7 @@ it('can fetch data', async () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
it('can build request async', async () => {
|
it('can build request async', async () => {
|
||||||
const config = utils.loadConfig('./tests/input/async.config.js')
|
const config = utils.loadConfig({ config: './tests/input/async.config.js' })
|
||||||
return utils.buildRequest({}, config).then(request => {
|
return utils.buildRequest({}, config).then(request => {
|
||||||
expect(request).toMatchObject({
|
expect(request).toMatchObject({
|
||||||
data: { accountID: '123' },
|
data: { accountID: '123' },
|
||||||
|
@ -136,14 +136,14 @@ it('can build request async', async () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
it('can load logo async', async () => {
|
it('can load logo async', async () => {
|
||||||
const config = utils.loadConfig('./tests/input/async.config.js')
|
const config = utils.loadConfig({ config: './tests/input/async.config.js' })
|
||||||
return utils.loadLogo({}, config).then(logo => {
|
return utils.loadLogo({}, config).then(logo => {
|
||||||
expect(logo).toBe('http://example.com/logos/1TV.png?x=шеллы&sid=777')
|
expect(logo).toBe('http://example.com/logos/1TV.png?x=шеллы&sid=777')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
it('can parse programs async', async () => {
|
it('can parse programs async', async () => {
|
||||||
const config = utils.loadConfig('./tests/input/async.config.js')
|
const config = utils.loadConfig({ config: './tests/input/async.config.js' })
|
||||||
return utils
|
return utils
|
||||||
.parsePrograms({ channel: { xmltv_id: '1tv', lang: 'en' } }, config)
|
.parsePrograms({ channel: { xmltv_id: '1tv', lang: 'en' } }, config)
|
||||||
.then(programs => {
|
.then(programs => {
|
||||||
|
|
Loading…
Reference in New Issue