From 6145a6994512f3907bce5587c949a0afc3cad0dc Mon Sep 17 00:00:00 2001 From: marek Date: Fri, 21 Oct 2022 01:42:45 -0400 Subject: [PATCH] fixed the url function: reversed the diff direction; removed unnecessary extra minute from currDate adjusted the test as well --- sites/programtv.onet.pl/programtv.onet.pl.config.js | 4 ++-- sites/programtv.onet.pl/programtv.onet.pl.test.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/sites/programtv.onet.pl/programtv.onet.pl.config.js b/sites/programtv.onet.pl/programtv.onet.pl.config.js index 7d5cd279..352321f2 100644 --- a/sites/programtv.onet.pl/programtv.onet.pl.config.js +++ b/sites/programtv.onet.pl/programtv.onet.pl.config.js @@ -12,8 +12,8 @@ module.exports = { delay: 5000, site: 'programtv.onet.pl', url: function ({ date, channel }) { - const currDate = dayjs.utc().startOf('d').add(1, 'm') - const day = currDate.diff(date, 'd') + const currDate = dayjs.utc().startOf('d') + const day = date.diff(currDate, 'd') return `https://programtv.onet.pl/program-tv/${channel.site_id}?dzien=${day}` }, diff --git a/sites/programtv.onet.pl/programtv.onet.pl.test.js b/sites/programtv.onet.pl/programtv.onet.pl.test.js index 8afef246..bbbcec68 100644 --- a/sites/programtv.onet.pl/programtv.onet.pl.test.js +++ b/sites/programtv.onet.pl/programtv.onet.pl.test.js @@ -24,7 +24,7 @@ it('can generate valid url', () => { }) it('can generate valid url for next day', () => { - MockDate.set(dayjs.utc('2021-11-25', 'YYYY-MM-DD').startOf('d')) + MockDate.set(dayjs.utc('2021-11-23', 'YYYY-MM-DD').startOf('d')) expect(url({ channel, date })).toBe( 'https://programtv.onet.pl/program-tv/13th-street-250?dzien=1' )