Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions apps/web/tests/document-content.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,15 @@ test("renders every document header in title, timestamps, source notice, body or
assert.ok(titleIndex < timestampsIndex);
assert.ok(timestampsIndex < sourceNoticeIndex);
assert.ok(sourceNoticeIndex < bodyIndex);
const firstBodyParagraph = /<p>([\s\S]*?)<\/p>/u
.exec(html.slice(bodyIndex))?.[1]
?.replace(/<[^>]+>/gu, "")
.trim();
assert.ok(firstBodyParagraph);
assert.ok(firstBodyParagraph.length >= 20);
assert.equal(
html.match(/新南威尔士州国家气象局/gu)?.length,
1,
html.slice(0, bodyIndex).includes(firstBodyParagraph),
false,
"article body must not be duplicated into the document header",
);
assert.match(html, /translation-status-badge/u);
Expand Down