diff --git a/sites/tv.dir.bg/tv.dir.bg.test.js b/sites/tv.dir.bg/tv.dir.bg.test.js new file mode 100644 index 00000000..bef02cba --- /dev/null +++ b/sites/tv.dir.bg/tv.dir.bg.test.js @@ -0,0 +1,55 @@ +// node ./scripts/commands/parse-channels.js --config=./sites/tv.dir.bg/tv.dir.bg.config.js --output=./sites/tv.dir.bg/tv.dir.bg_bg.channels.xml +// npx epg-grabber --config=sites/tv.dir.bg/tv.dir.bg.config.js --channels=sites/tv.dir.bg/tv.dir.bg_bg.channels.xml --output=guide.xml --days=2 + +const { parser, url } = require('./tv.dir.bg.config.js') +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('2022-01-20', 'YYYY-MM-DD').startOf('d') +const channel = { + site_id: '12', + xmltv_id: 'BTV.bg' +} + +it('can generate valid url', () => { + expect(url({ channel, date })).toBe('https://tv.dir.bg/tv_channel.php?id=12&dd=20.01') +}) + +it('can parse response', () => { + const content = `