From 9befe4ec6a2092ad7ab586194c0dda8b67e7dde9 Mon Sep 17 00:00:00 2001 From: freearhey <7253922+freearhey@users.noreply.github.com> Date: Sun, 3 May 2026 15:31:28 +0300 Subject: [PATCH] Create x1co.com.br.test.js --- sites/x1co.com.br/x1co.com.br.test.js | 43 +++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 sites/x1co.com.br/x1co.com.br.test.js diff --git a/sites/x1co.com.br/x1co.com.br.test.js b/sites/x1co.com.br/x1co.com.br.test.js new file mode 100644 index 000000000..7444e728e --- /dev/null +++ b/sites/x1co.com.br/x1co.com.br.test.js @@ -0,0 +1,43 @@ +const { parser, url } = require('./x1co.com.br.config.js') +const fs = require('fs') +const path = require('path') +const dayjs = require('dayjs') +const utc = require('dayjs/plugin/utc') +const customParseFormat = require('dayjs/plugin/customParseFormat') +dayjs.extend(customParseFormat) +dayjs.extend(utc) + +const date = dayjs.utc('2026-05-04', 'YYYY-MM-DD').startOf('d') +const channel = { site_id: 'nickonline.br' } + +it('can generate valid url', () => { + expect(url).toBe('https://x1co.com.br/epg/epg.xml') +}) + +it('can parse response', () => { + const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.xml')) + + const results = parser({ content, channel, date }) + + expect(results.length).toBe(46) + expect(results[0]).toMatchObject({ + title: 'Bob Esponja', + subTitle: 'T13 Ep1', + description: 'Bob Esponja — T13 Ep1', + category: 'Infantil', + start: '2026-05-04T00:02:39.000Z', + stop: '2026-05-04T00:14:06.000Z' + }) + expect(results[45]).toMatchObject({ + title: 'Tainá e Os Guardiões da Amazônia', + category: 'Infantil', + start: '2026-05-04T11:28:01.000Z', + stop: '2026-05-04T11:39:41.000Z' + }) +}) + +it('can handle empty guide', () => { + const results = parser({ content: '' }) + + expect(results).toMatchObject([]) +})