Skip to content

Commit

Permalink
test: fix broken tests (anuraghazra#926)
Browse files Browse the repository at this point in the history
  • Loading branch information
anuraghazra authored Mar 7, 2021
1 parent c8a5e83 commit 922f716
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tests/renderStatsCard.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -234,39 +234,39 @@ describe("Test renderStatsCard", () => {
it("should render translations", () => {
document.body.innerHTML = renderStatsCard(stats, { locale: "cn" });
expect(document.getElementsByClassName("header")[0].textContent).toBe(
"Anurag Hazra 的 GitHub 统计",
"Anurag Hazra 的 GitHub 统计数据",
);
expect(
document.querySelector(
'g[transform="translate(0, 0)"]>.stagger>.stat.bold',
).textContent,
).toBe("获标星(star):");
).toMatchInlineSnapshot(`"获标星数(star):"`);
expect(
document.querySelector(
'g[transform="translate(0, 25)"]>.stagger>.stat.bold',
).textContent,
).toBe(`累计提交(commit) (${new Date().getFullYear()}):`);
).toMatchInlineSnapshot(`"累计提交数(commit) (2021):"`);
expect(
document.querySelector(
'g[transform="translate(0, 50)"]>.stagger>.stat.bold',
).textContent,
).toBe("提案数(PR):");
).toMatchInlineSnapshot(`"拉取请求数(PR):"`);
expect(
document.querySelector(
'g[transform="translate(0, 75)"]>.stagger>.stat.bold',
).textContent,
).toBe("指出问题(issue):");
).toMatchInlineSnapshot(`"指出问题数(issue):"`);
expect(
document.querySelector(
'g[transform="translate(0, 100)"]>.stagger>.stat.bold',
).textContent,
).toBe("参与项目数:");
).toMatchInlineSnapshot(`"参与项目数:"`);
});

it("should render without rounding", () => {
document.body.innerHTML = renderStatsCard(stats, { border_radius: "0" });
expect(document.querySelector("rect")).toHaveAttribute("rx", "0");
document.body.innerHTML = renderStatsCard(stats, { });
document.body.innerHTML = renderStatsCard(stats, {});
expect(document.querySelector("rect")).toHaveAttribute("rx", "4.5");
});
});

0 comments on commit 922f716

Please sign in to comment.