Update utils.test.js
This commit is contained in:
parent
d371d6d7fb
commit
b56edf7250
|
@ -23,6 +23,9 @@ it('can load valid config.js', () => {
|
||||||
expect(typeof config.request.data).toEqual('function')
|
expect(typeof config.request.data).toEqual('function')
|
||||||
expect(typeof config.url).toEqual('function')
|
expect(typeof config.url).toEqual('function')
|
||||||
expect(typeof config.logo).toEqual('function')
|
expect(typeof config.logo).toEqual('function')
|
||||||
|
expect(config.request.data()).toEqual({ accountID: '123' })
|
||||||
|
expect(config.url()).toEqual('http://example.com/20210319/1tv.json')
|
||||||
|
expect(config.logo()).toEqual('http://example.com/logos/1TV.png?x=шеллы&sid=777')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('can parse valid channels.xml', () => {
|
it('can parse valid channels.xml', () => {
|
||||||
|
@ -55,14 +58,14 @@ it('can convert object to xmltv string', () => {
|
||||||
start: '2021-03-19 06:00:00 +0000',
|
start: '2021-03-19 06:00:00 +0000',
|
||||||
stop: '2021-03-19 06:30:00 +0000',
|
stop: '2021-03-19 06:30:00 +0000',
|
||||||
category: 'Test',
|
category: 'Test',
|
||||||
icon: 'https://example.com/images/Program1.png',
|
icon: 'https://example.com/images/Program1.png?x=шеллы&sid=777',
|
||||||
channel: '1TV.com',
|
channel: '1TV.com',
|
||||||
lang: 'it'
|
lang: 'it'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
const output = utils.convertToXMLTV({ channels, programs })
|
const output = utils.convertToXMLTV({ channels, programs })
|
||||||
expect(output).toBe(
|
expect(output).toBe(
|
||||||
'<?xml version="1.0" encoding="UTF-8" ?><tv>\r\n<channel id="1TV.com"><display-name>1 TV</display-name><icon src="https://example.com/logos/1TV.png"/></channel>\r\n<channel id="2TV.com"><display-name>2 TV</display-name></channel>\r\n<programme start="20210319060000 +0000" stop="20210319063000 +0000" channel="1TV.com"><title lang="it">Program 1</title><desc lang="it">Description for Program 1</desc><category lang="it">Test</category><icon src="https://example.com/images/Program1.png"/></programme>\r\n</tv>'
|
'<?xml version="1.0" encoding="UTF-8" ?><tv>\r\n<channel id="1TV.com"><display-name>1 TV</display-name><icon src="https://example.com/logos/1TV.png"/></channel>\r\n<channel id="2TV.com"><display-name>2 TV</display-name></channel>\r\n<programme start="20210319060000 +0000" stop="20210319063000 +0000" channel="1TV.com"><title lang="it">Program 1</title><desc lang="it">Description for Program 1</desc><category lang="it">Test</category><icon src="https://example.com/images/Program1.png?x=шеллы&sid=777"/></programme>\r\n</tv>'
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue