Skip to content

Commit

Permalink
test(flaws): test that fallback links are fixabln broken link flaws
Browse files Browse the repository at this point in the history
  • Loading branch information
caugner committed Mar 15, 2024
1 parent 40fddf3 commit 6ee38ef
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions testing/tests/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1614,9 +1614,21 @@ test("translated content broken links can fall back to en-us", () => {
doc: Doc;
};

const brokenHrefs = doc.flaws.broken_links.map((x) => x.href);
expect(brokenHrefs).not.toContain("/fr/docs/Web/CSS/dumber");
expect(brokenHrefs).not.toContain("/fr/docs/Web/CSS/number");
const map = new Map(doc.flaws.broken_links.map((x) => [x.href, x]));
expect(map.get("/fr/docs/Web/CSS/dumber")).toMatchObject({
explanation: "Can't resolve /fr/docs/Web/CSS/dumber",
suggestion: "/en-US/docs/Web/CSS/dumber",
fixable: true,
line: 19,
column: 16,
});
expect(map.get("/fr/docs/Web/CSS/number")).toMatchObject({
explanation: "Can't resolve /fr/docs/Web/CSS/number",
suggestion: "/en-US/docs/Web/CSS/number",
fixable: true,
line: 21,
column: 14,
});

const htmlFile = path.join(builtFolder, "index.html");
const html = fs.readFileSync(htmlFile, "utf-8");
Expand Down

0 comments on commit 6ee38ef

Please sign in to comment.