Skip to content

Commit

Permalink
Get tests to pass
Browse files Browse the repository at this point in the history
  • Loading branch information
ptgott committed Oct 8, 2024
1 parent cf9b87c commit a2a241a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion server/remark-includes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ const resolveIncludes = ({
}

// Catch unresolved parameters, which can break docs builds
const paramRE = new RegExp(`{{ ?\w+ ?}}`, "g");
const paramRE = new RegExp(`{{ ?\\w+ ?}}`, "g");
const unresolvedParams = Array.from(content.matchAll(paramRE));
if (unresolvedParams.length > 0) {
const errs = unresolvedParams
Expand Down
15 changes: 11 additions & 4 deletions uvu-tests/remark-includes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -489,12 +489,19 @@ Suite("Throws an error if a variable is unresolved and has no default", () => {
"utf-8"
);

assert.throws(() => {
transformer({
const out = transformer(
{
value,
path: "/content/4.0/docs/pages/filename.mdx",
});
}, "not assigned and have no default value");
},
{ lint: true }
);

assert.equal(out.messages.length, 1);
assert.equal(
out.messages[0].reason,
"The following partial parameters were not assigned and have no default value: {{ unsupported }}"
);
});

Suite(
Expand Down

0 comments on commit a2a241a

Please sign in to comment.