authelia/web/src/components/PieChartIcon.test.tsx
Amir Zarrinkafsh 1b06e46f71
test(web): drop enzyme in favor of react-testing-library (#2224)
* test(web): drop enzyme in favor of react-testing-library

Enzyme is falling behind in maintenance, it is currently maintained by one primary developer and still does [not support React 17](https://github.com/enzymejs/enzyme/pull/2430) despite it being released in October 2020.

[react-testing-library (RTL)](https://testing-library.com/docs) is [recommended by Facebook](https://reactjs.org/docs/test-utils.html#overview) and encourages writing tests that avoid testing implementation details.

* build(deps): update react monorepo to v17 (major)

* build(deps): remove @types/{enzyme,jest}
2021-08-03 16:25:13 +10:00

30 lines
785 B
TypeScript

import React from "react";
import { render } from "@testing-library/react";
import PieChartIcon from "@components/PieChartIcon";
it("renders without crashing", () => {
render(<PieChartIcon progress={40} />);
});
it("renders maxProgress without crashing", () => {
render(<PieChartIcon progress={40} maxProgress={100} />);
});
it("renders width without crashing", () => {
render(<PieChartIcon progress={40} width={20} />);
});
it("renders height without crashing", () => {
render(<PieChartIcon progress={40} height={20} />);
});
it("renders color without crashing", () => {
render(<PieChartIcon progress={40} color="black" />);
});
it("renders backgroundColor without crashing", () => {
render(<PieChartIcon progress={40} backgroundColor="white" />);
});