test_served_pages_carry_the_comment_control

Tests › tests/test_wiki_hub.py

passed Passed in the packaged run.

What this test is for

Why it exists

The hub injects `/comment.js` with `/live.js`; the static site stays server-free.

Verifies REQ-DDB-WIKI-032 REQ-DDB-WIKI-033 REQ-DDB-WIKI-054

Given

  1. server, builder, live, _gone = hub
  2. builder.release.set()
6 more
  1. site = server.site_dir(live)
  2. site.mkdir(parents=True, exist_ok=True)
  3. (site / "index.html").write_text("<html><body><p>x</p></body></html>")
  4. cookie = f"clew_wiki={server.token}"
  5. _s, page, _h = _get(f"http://127.0.0.1:{server.port}/r/{live.slug}/", cookie)
  6. status, script, headers = _get(f"http://127.0.0.1:{server.port}/comment.js", cookie)
→

When

  1. —
→

Then

  1. ✓ page contains '<script src="/comment.js"></script>'
  2. ✓ status equals 200
  3. ✓ script contains "/comment"
  4. ✓ headers["Content-Type"] contains "javascript"
  5. ✓ script contains "textContent"
  6. ✓ script does not contain "innerHTML"

What it exercises

The parts of the system's flows this test ran, measured by per-test coverage: lit steps ran in this test, dimmed ones did not, and ▶ marks where the test called in. Each title opens the whole flow with these steps lit.

thread `WikiHub._build` — `_build` (clew/mcp_server/wikihub.py) · 1 of 7 steps

thread startthread startthread startthread startAnswer: query engine + MCP serverAnswer: query engine + MCP serverAnswer: query engine + MCP serverAnswer: query engine + MCP serverWiki: this siteWiki: this siteWiki: this siteWiki: this sitetry (line 334)tryloop (line 115)loop_build1. _build → site_dir1site_dir2. site_dir → wiki_site_dir2wiki_site_dir▶ test enters3. _build → publish3publish4. publish → list4list

… 3 later steps

tests/test_wiki_hub.py:437 · its file's page

What it checks (3)

  1. assert '<script src="/comment.js"></script>' in page not attributed
  2. assert status == 200 and "/comment" in script and "javascript" in headers["Content-Type"] not attributed
  3. assert "textContent" in script and "innerHTML" not in script not attributed

Where the product reaches it

No product flow reaches this code: no product entry point's flow calls any of the functions this test calls.

Call flow

test_served_pages_carry_the_comment_control→_get

What it reaches

Each row runs from this test, through the calls it makes, to the code a requirement names. If that code breaks, the test's checks are what should catch it. Reaching is not proving: a check only proves what it observes. No mutation records were given, so these rows say what the test REACHES.

Requirements it verifies (3)

requirementlinked byimplementers exercised
REQ-DDB-WIKI-032catalogunknown
REQ-DDB-WIKI-033catalogunknown
REQ-DDB-WIKI-054catalogunknown
Also reaches 2 requirements

Its run touches their code; that is reach, not proof.