github-readme-stats/tests/renderWakatimeCard.test.js
Willian Rodrigues 94aeabe300
feat: add wakatime compact layout (#560)
* Add wakatime compact layout

* Update readme

* test: added & updated test snapshots

Co-authored-by: Anurag <hazru.anurag@gmail.com>
2020-11-04 23:51:57 +05:30

30 lines
920 B
JavaScript

require("@testing-library/jest-dom");
const renderWakatimeCard = require("../src/cards/wakatime-card");
const { wakaTimeData } = require("./fetchWakatime.test");
describe("Test Render Wakatime Card", () => {
it("should render correctly", () => {
const card = renderWakatimeCard(wakaTimeData.data);
expect(card).toMatchSnapshot();
});
it("should render correctly with compact layout", () => {
const card = renderWakatimeCard(wakaTimeData.data, { layout: "compact" });
expect(card).toMatchSnapshot();
});
it("should render translations", () => {
document.body.innerHTML = renderWakatimeCard({}, { locale: "cn" });
expect(document.getElementsByClassName("header")[0].textContent).toBe(
"Wakatime 周统计",
);
expect(
document.querySelector('g[transform="translate(0, 0)"]>text.stat.bold')
.textContent,
).toBe("本周没有编程活动");
});
});