From 4d41ed8740a5c9e0d8d41f7c866908d24ceed76d Mon Sep 17 00:00:00 2001 From: freearhey <7253922+freearhey@users.noreply.github.com> Date: Sat, 23 Aug 2025 23:32:06 +0300 Subject: [PATCH] Create passie.nl.test.js --- sites/passie.nl/passie.nl.test.js | 45 +++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 sites/passie.nl/passie.nl.test.js diff --git a/sites/passie.nl/passie.nl.test.js b/sites/passie.nl/passie.nl.test.js new file mode 100644 index 00000000..9b19e775 --- /dev/null +++ b/sites/passie.nl/passie.nl.test.js @@ -0,0 +1,45 @@ +const { parser, url } = require('./passie.nl.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') +dayjs.extend(customParseFormat) +dayjs.extend(utc) + +const date = dayjs.utc('2025-08-26', 'YYYY-MM-DD').startOf('d') + +it('can generate valid url', () => { + expect(url({ date })).toBe('https://passie.nl/tvgids.php?day=2025-08-26') +}) + +it('can parse response', () => { + const content = fs.readFileSync(path.resolve(__dirname, '__data__/content.html')) + + let results = parser({ content, date }) + results = results.map(p => { + p.start = p.start.toJSON() + p.stop = p.stop.toJSON() + + return p + }) + + expect(results.length).toBe(45) + expect(results[0]).toMatchObject({ + title: 'Young Anal Charm - Scene 1', + start: '2025-08-25T21:43:00.000Z', + stop: '2025-08-25T22:00:00.000Z' + }) + expect(results[44]).toMatchObject({ + title: 'Stud Doctor Slams Slutty Nurse', + start: '2025-08-26T21:45:00.000Z', + stop: '2025-08-26T22:00:00.000Z' + }) +}) + +it('can handle empty guide', () => { + const content = fs.readFileSync(path.resolve(__dirname, '__data__/no_content.html')) + const results = parser({ content, date }) + + expect(results).toMatchObject([]) +})