Skip to content

Commit

Permalink
Update rikstv.no.test.js
Browse files Browse the repository at this point in the history
  • Loading branch information
fraudiay79 authored Jan 14, 2025
1 parent af248ce commit b9b3893
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions sites/rikstv.no/rikstv.no.test.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
const { parser, url, channels } = require('./rikstv.no.config.js');
const dayjs = require('dayjs');
const utc = require('dayjs/plugin/utc');
const customParseFormat = require('dayjs/plugin/customParseFormat');
const { parser, url } = require('./rikstv.no.config.js')
const dayjs = require('dayjs')
const utc = require('dayjs/plugin/utc')
const customParseFormat = require('dayjs/plugin/customParseFormat')

dayjs.extend(customParseFormat);
dayjs.extend(utc);
dayjs.extend(customParseFormat)
dayjs.extend(utc)

const date = dayjs.utc('2025-01-14', 'YYYY-MM-DD').startOf('d');
const date = dayjs.utc('2025-01-14', 'YYYY-MM-DD').startOf('d')
const channel = {
site_id: '47',
xmltv_id: 'NRK1.no'
};
}

describe('rikstv.no Module Tests', () => {
it('can generate valid url', () => {
expect(url({ date, channel })).toBe(`https://play.rikstv.no/api/content-search/1/channel/${channel.site_id}/epg/${date.format('YYYY-MM-DD')}`);
});
expect(url({ date, channel })).toBe(`https://play.rikstv.no/api/content-search/1/channel/${channel.site_id}/epg/${date.format('YYYY-MM-DD')}`)
})

it('can parse response', () => {
const content = JSON.stringify([
Expand All @@ -32,13 +32,13 @@ describe('rikstv.no Module Tests', () => {
broadcastedTime: '2025-01-13T23:00:00Z',
broadcastedTimeEnd: '2025-01-13T23:55:00Z'
}
]);
])

const result = parser({ content, channel }).map(p => {
p.start = p.start.toJSON();
p.stop = p.stop.toJSON();
return p;
});
const result = parser({ content }).map(p => {
p.start = p.start.toJSON()
p.stop = p.stop.toJSON()
return p
})

expect(result).toMatchObject([
{
Expand All @@ -54,13 +54,13 @@ describe('rikstv.no Module Tests', () => {
start: '2025-01-13T23:00:00.000Z',
stop: '2025-01-13T23:55:00.000Z'
}
]);
});
])
})

it('can handle empty guide', () => {
const result = parser({
content: '[]'
});
expect(result).toMatchObject([]);
});
});
})
expect(result).toMatchObject([])
})
})

0 comments on commit b9b3893

Please sign in to comment.