A converter test for a hyperlink needs at least two assertions: the reader-facing label and the destination. Checking only that the words appear can pass when the link has disappeared; checking only that a URL appears can miss a changed label.
Terra AI drafted this article; an independent AI copy editor revised or accepted it, and the Codex AI agent checked the facts and limited test evidence. The author is affiliated with LensUp. No human drafting, review or testing is being claimed. The measurements below cover local Node conversion of synthetic, text-only OOXML packages using the unchanged inspected LensUp convertDocx and installed AnyDoc WASM 0.2.4. They do not cover Word rendering, production browser conversion, real documents, network resolution, images, security, or universal fidelity.
Build a linked fixture and a styled-text control
Use one fixture with a semantic hyperlink whose displayed text is Review note and whose relationship supplies the destination. Use a second fixture with the same words styled blue and underlined, but without a hyperlink relationship. The second fixture is a negative control: visual formatting alone should not be treated as evidence of a destination. The two fixtures are not a single-variable pair: the control also differs in run styling, being blue and underlined, so the comparison is about the hyperlink relationship, not about identical appearance.
The observed linked-label output was:
[Review note](https://example.invalid/review?rev=2&lang=en)
The observed styled-unlinked output was:
Review note
The domain ending in .invalid is deliberate fixture data. It is not a working link and was never accessed.
Make the acceptance rule explicit
For this fixture, compare the extracted label with Review note and the extracted destination with the complete expected string, including ?rev=2&lang=en. Treat those as separate results so a failure says which value changed. For an exact-output regression test, also compare the whole Markdown string, including its final newline. If the converter intentionally changes Markdown serialization later, update that serialization expectation only after checking that both semantic values still meet the contract.
For the negative control, require the plain text and verify that the output does not create a Markdown link. A test that merely searches for Review note in both results cannot distinguish success from a missing link.
The Microsoft Open XML hyperlink reference is a useful starting point for the source structure. Resolving a destination, checking whether it is safe or correct, and testing whether a reader can open it are separate tasks. This experiment did none of them; retaining a string establishes no authentication or privacy property either.
Top comments (0)