import assert from "node:assert/strict"; const baseUrl = process.env.WORKSHOP_TEST_URL; const remoteUrl = process.env.WORKSHOP_REMOTE_API_URL?.replace(/\/$/, "").replace(/\/api$/, ""); assert.ok(baseUrl && remoteUrl, "WORKSHOP_TEST_URL and WORKSHOP_REMOTE_API_URL are required"); const response = await fetch(`${remoteUrl}/api/collections/workshop_listings/records?perPage=100`); assert.equal(response.status, 200); const { items } = await response.json(); assert.ok(items.length > 0, "Remote backend must contain public listings"); const escapeHtml = (value) => value .replaceAll("&", "&") .replaceAll("<", "<") .replaceAll(">", ">") .replaceAll('"', """) .replaceAll("'", "'"); for (const item of items) { const page = await fetch(`${baseUrl}/workshop/${item.id}/`); assert.equal(page.status, 200, item.title); const html = await page.text(); assert.ok(html.includes(`