diff --git a/tests/headline-xss.test.mjs b/tests/headline-xss.test.mjs index e97612c..ed6704a 100644 --- a/tests/headline-xss.test.mjs +++ b/tests/headline-xss.test.mjs @@ -43,6 +43,8 @@ function xssFixture() { visuals: { hero: { file: heroFile }, architectureDiagram: { svgPath: archFile, altText: 'architecture' }, + // the page image contract now requires at least one generated problem/use-case image + sections: [{ id: 'problem', file: heroFile, alt: 'the problem' }], }, brand: { socialCard: { file: cardFile }, @@ -66,3 +68,28 @@ test( 'an event-handler attribute authored into content must never reach the rendered page verbatim'); } ); + +// JSON-LD block (SEO): content from the repo must never break out of its '; + bj.repo.name = hostile; + fs.writeFileSync(path.join(dir, 'build.json'), JSON.stringify(bj)); + const r = spawnSync(process.execPath, [path.join(ROOT, 'tools', 'assemble-page.mjs'), dir], { encoding: 'utf8' }); + assert.equal(r.status, 0, `fixture must render cleanly (got exit ${r.status}: ${r.stdout} ${r.stderr})`); + const html = fs.readFileSync(path.join(dir, 'site', 'index.html'), 'utf8'); + const open = html.indexOf('', open); + const body = html.slice(open + '