Merge pull request #1200 from mgroma/master

Polish TV: fixed the day logic in url()
This commit is contained in:
Aleksandr Statciuk 2022-10-22 04:45:09 +03:00 committed by GitHub
commit 1388c9de3e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View file

@ -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}`
},

View file

@ -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'
)