stremio/apps/master-api/src/openf1/news.test.ts
Jos Vooges | STH 84cc1e99f9 Add OpenF1 live timing in the iOS F1 hub, with credentials stored in admin.
Login lives encrypted in the database (Instellingen → OpenF1) so the phone can use live data without env secrets.
2026-10-01 01:22:46 +02:00

24 lines
1.1 KiB
TypeScript

import assert from "node:assert/strict";
import { parseRacingNews365 } from "./news";
const html = `
<a href="https://racingnews365.nl/f1-nieuws" class="card card--default">skip</a>
<a
href="https://racingnews365.nl/hadjar-doet-boekje-open-over-polsbreuk-heel-stom"
class="card card--default
"
data-id="14443134"
>
<span class="card__title"><span data-ab-title="14443134">Hadjar doet boekje open over polsbreuk: &quot;Heel stom&quot;</span></span>
<time datetime="2026-09-30T20:30:00+02:00">30 september 20:30</time>
<img srcset="https://cdn.racingnews365.com/2026/Hadjar/XPB.jpg?width=360&amp;height=203 1x">
</a>
<a href="https://racingnews365.nl/coureurs" class="card card--default"><span data-ab-title="1">Coureurs</span></a>
`;
const items = parseRacingNews365(html);
assert.equal(items.length, 1);
assert.equal(items[0].title, 'Hadjar doet boekje open over polsbreuk: "Heel stom"');
assert.equal(items[0].id, "14443134");
assert.ok(items[0].imageUrl?.includes("cdn.racingnews365.com"));
console.log("openf1/news.test.ts ok");