From 79126803c12604e3e2f1cbc8723934f38a975726 Mon Sep 17 00:00:00 2001 From: Aleksandr Statciuk Date: Fri, 1 Jul 2022 06:09:16 +0300 Subject: [PATCH] Update kvf.fo.test.js --- sites/kvf.fo/kvf.fo.test.js | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/sites/kvf.fo/kvf.fo.test.js b/sites/kvf.fo/kvf.fo.test.js index 181d6515..2493c982 100644 --- a/sites/kvf.fo/kvf.fo.test.js +++ b/sites/kvf.fo/kvf.fo.test.js @@ -1,6 +1,8 @@ -// npx epg-grabber --config=sites/kvf.fo/kvf.fo.config.js --channels=sites/kvf.fo/kvf.fo_fo.channels.xml --output=.gh-pages/guides/fo/kvf.fo.epg.xml --days=2 +// npx epg-grabber --config=sites/kvf.fo/kvf.fo.config.js --channels=sites/kvf.fo/kvf.fo_fo.channels.xml --output=guide.xml --days=2 const { parser, url } = require('./kvf.fo.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') @@ -14,34 +16,22 @@ const channel = { } it('can generate valid url', () => { - expect(url({ date })).toBe('https://kvf.fo/nskra/uv?date=2021-11-21') + expect(url({ date })).toBe('https://kvf.fo/nskra/sv?date=2021-11-21') }) it('can parse response', () => { - const content = `
00:00 - 02:00
Plátubarrin
23:00 - 00:00
Tónleikur
00:00 - 01:00
Náttarrásin
` + const content = fs.readFileSync(path.resolve(__dirname, './__data__/example.html')) const result = parser({ content, date }).map(p => { p.start = p.start.toJSON() p.stop = p.stop.toJSON() return p }) - expect(result).toMatchObject([ - { - start: '2021-11-21T00:00:00.000Z', - stop: '2021-11-21T02:00:00.000Z', - title: `Plátubarrin` - }, - { - start: '2021-11-21T23:00:00.000Z', - stop: '2021-11-22T00:00:00.000Z', - title: `Tónleikur` - }, - { - start: '2021-11-22T00:00:00.000Z', - stop: '2021-11-22T01:00:00.000Z', - title: `Náttarrásin` - } - ]) + expect(result[2]).toMatchObject({ + start: '2021-11-21T18:05:00.000Z', + stop: '2021-11-21T18:30:00.000Z', + title: `Letibygd 13` + }) }) it('can handle empty guide', () => {