Update utils.test.js

This commit is contained in:
Aleksandr Statciuk 2022-04-09 18:43:10 +03:00
parent ccd2813917
commit 4ae18b24dd
1 changed files with 22 additions and 0 deletions

View File

@ -73,6 +73,28 @@ it('can convert object to xmltv string', () => {
)
})
it('can convert object to xmltv string without season number', () => {
const file = fs.readFileSync('./tests/input/example.com.channels.xml', { encoding: 'utf-8' })
const { channels } = utils.parseChannels(file)
const programs = [
{
title: 'Program 1',
description: 'Description for Program 1',
start: 1616133600,
stop: 1616135400,
category: 'Test',
episode: 239,
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"/><url>https://example.com</url></channel>\r\n<channel id="2TV.com"><display-name>2 TV</display-name><url>https://example.com</url></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><episode-num system="xmltv_ns">0.238.0/1</episode-num><episode-num system="onscreen">S01E239</episode-num><icon src="https://example.com/images/Program1.png?x=шеллы&amp;sid=777"/></programme>\r\n</tv>'
)
})
it('can convert object to xmltv string without categories', () => {
const channels = [
{