diff --git a/tests/boundary/cli/githubActionsExample.test.ts b/tests/boundary/cli/githubActionsExample.test.ts index c6d7067f05..9c1e604053 100644 --- a/tests/boundary/cli/githubActionsExample.test.ts +++ b/tests/boundary/cli/githubActionsExample.test.ts @@ -110,9 +110,10 @@ it("links to the workflow asset outside the documentation site's base", async () const workflowLinks = new MarkdownIt() .parse(guide, {}) .flatMap((token) => token.children ?? []) - .flatMap((token) => - token.type === "link_open" ? [token.attrGet("href") ?? ""] : [], - ) + .flatMap((token) => { + const href = token.type === "link_open" ? token.attrGet("href") : null; + return typeof href === "string" ? [href] : []; + }) .filter((href) => href.endsWith("examples/github-actions/rea-analysis.yml"), ); diff --git a/tests/conformance/readmeConsistency.test.ts b/tests/conformance/readmeConsistency.test.ts index deebdaca6a..6552ec3a56 100644 --- a/tests/conformance/readmeConsistency.test.ts +++ b/tests/conformance/readmeConsistency.test.ts @@ -98,7 +98,7 @@ describe("onboarding documentation product facts", () => { for (const child of token.children ?? []) { const href = child.type === "link_open" ? child.attrGet("href") : null; - if (href?.startsWith("#")) + if (typeof href === "string" && href.startsWith("#")) fragments.push(decodeURIComponent(href.slice(1))); } }