Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 0 additions & 1 deletion scripts/coverage-floor.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ export const TEST_HELPER_BASELINE = {
"scripts/dependabot-config.test.mjs": 9,
"scripts/issue-forms.test.mjs": 15,
"scripts/jsonld-contract.test.mjs": 14,
"scripts/llms-txt.test.mjs": 3,
"scripts/no-js-controls.test.mjs": 5,
"scripts/page-404.test.mjs": 5,
"scripts/page-images.test.mjs": 19,
Expand Down
23 changes: 23 additions & 0 deletions scripts/llms-txt.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,29 @@ test("chipsIn reads chip name and trailing note, decoding entities and skipping
assert.deepEqual(chipsIn(null), []);
});

test("sectionByHeading needs an enclosing <section>; chipsIn skips chip-less items and reads a bare chip's note as empty", () => {
// The heading id exists but no <section> opens before it: the markup moved
// out of a section, so the gate must say "not found" rather than slice from
// index -1 and compare against a bogus fragment.
assert.equal(sectionByHeading('<div><h3 id="loose-title">Loose</h3></div></section>', "loose-title"), null);
// ...and the mirror: a section opens but never closes after the heading.
assert.equal(sectionByHeading('<section><h3 id="open-title">Open</h3>', "open-title"), null);
// An <li> without an integration-chip span (a "more coming" placeholder, a
// divider) is not a chip; a chip whose only span is the logo image has no
// note, so classifier filtering sees "" instead of the chip name.
const section = `<section>
<ul>
<li><em>More coming soon</em></li>
<li><a href="#"><span class="integration-chip"><img src="/bare.svg" alt="Bare"></span></a></li>
<li><a href="#"><span class="integration-chip">Noted</span><span>backend: noted</span></a></li>
</ul>
</section>`;
assert.deepEqual(chipsIn(section), [
{ name: '<img src="/bare.svg" alt="Bare">', note: "" },
{ name: "Noted", note: "backend: noted" },
]);
});

test("inferenceChipNames unions engines and gateways but drops classifier chips", () => {
assert.deepEqual(inferenceChipNames(FIXTURE_HTML), ["Engine", "Gateway"]);
});
Expand Down
Loading