Update utils.test.js

This commit is contained in:
freearhey 2021-04-26 15:47:12 +03:00
parent d371d6d7fb
commit b56edf7250
1 changed files with 5 additions and 2 deletions

View File

@ -23,6 +23,9 @@ it('can load valid config.js', () => {
expect(typeof config.request.data).toEqual('function')
expect(typeof config.url).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', () => {
@ -55,14 +58,14 @@ it('can convert object to xmltv string', () => {
start: '2021-03-19 06:00:00 +0000',
stop: '2021-03-19 06:30:00 +0000',
category: 'Test',
icon: 'https://example.com/images/Program1.png',
icon: 'https://example.com/images/Program1.png?x=шеллы&sid=777',
channel: '1TV.com',
lang: 'it'
}
]
const output = utils.convertToXMLTV({ channels, programs })
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=шеллы&amp;sid=777"/></programme>\r\n</tv>'
)
})