Clean up tests

Signed-off-by: Alex Andreev <alex.andreev.email@gmail.com>
This commit is contained in:
Alex Andreev committed 2022-05-18 13:53:34 +03:00
1 parent 3888e46e2f
commit 4d0e841343
3 files changed
+14 -4

No files matched your search

@@ -4,6 +4,7 @@ exports[`<UpdateButton/> should render if warning level prop passed 1`] = `
<button
class="updateButton"
data-testid="update-button"
data-warning-level="light"
id="update-lens-button"
>
Update
@@ -51,19 +51,27 @@ describe("<UpdateButton/>", () => {
expect(update).toHaveBeenCalled();
});
it("should have class name with medium warning level", () => {
it("should have light warning level", () => {
const { getByTestId } = render(<UpdateButton update={update} warningLevel="light" />);
const button = getByTestId("update-button");
expect(button.dataset.warningLevel).toBe("light");
});
it("should have medium warning level", () => {
const { getByTestId } = render(<UpdateButton update={update} warningLevel="medium" />);
const button = getByTestId("update-button");
expect(button.className.toLowerCase().includes("medium")).toBeTruthy();
expect(button.dataset.warningLevel).toBe("medium");
});
it("should have class name with high warning level", () => {
it("should have high warning level", () => {
const { getByTestId } = render(<UpdateButton update={update} warningLevel="high" />);
const button = getByTestId("update-button");
expect(button.className.toLowerCase().includes("high")).toBeTruthy();
expect(button.dataset.warningLevel).toBe("high");
});
});
@@ -34,6 +34,7 @@ export function UpdateButton({ warningLevel, update, id }: UpdateButtonProps) {
<>
<button
data-testid="update-button"
data-warning-level={warningLevel}
id={buttonId}
className={cssNames(styles.updateButton, {
[styles.warningHigh]: warningLevel === "high",