diff --git a/tests/renderStatsCard.test.js b/tests/renderStatsCard.test.js index 53262dddbc8af..96a48d1a9d7bd 100644 --- a/tests/renderStatsCard.test.js +++ b/tests/renderStatsCard.test.js @@ -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"); }); });