Skip to content

Commit

Permalink
Improve unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
lslezak committed May 2, 2024
1 parent da9ec7d commit 2f954fa
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions web/src/components/storage/InstallationDeviceField.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ import { screen, within } from "@testing-library/react";
import { installerRender } from "~/test-utils";
import InstallationDeviceField from "~/components/storage/InstallationDeviceField";

jest.mock("@patternfly/react-core", () => {
const original = jest.requireActual("@patternfly/react-core");

return {
...original,
Skeleton: () => <div>PF-Skeleton</div>
};
});

/**
* @typedef {import ("~/components/storage/InstallationDeviceField").InstallationDeviceFieldProps} InstallationDeviceFieldProps
* @typedef {import ("~/client/storage").StorageDevice} StorageDevice
Expand Down Expand Up @@ -97,10 +106,10 @@ describe("when set as loading", () => {
});

it("renders a loading hint", () => {
const { container } = installerRender(<InstallationDeviceField {...props} />);
installerRender(<InstallationDeviceField {...props} />);

// a PF skeleton is displayed
expect(container.querySelector("div.pf-v5-c-skeleton")).toBeVisible();
screen.getByText("PF-Skeleton");
});
});

Expand Down

0 comments on commit 2f954fa

Please sign in to comment.