Skip to content

Commit

Permalink
Update unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lslezak committed Aug 30, 2023
1 parent 8645700 commit 13b3041
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions web/src/components/storage/ProposalActionsSection.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,14 @@ describe("when there are actions", () => {
<ProposalActionsSection actions={[...actions, ...subvolumeActions]} />
);

const link = screen.getByText(/Show.*subvolumes actions/);
const link = screen.getByText(/Show.*subvolume actions/);

expect(screen.getAllByRole("list").length).toEqual(1);

await user.click(link);

waitForElementToBeRemoved(link);
screen.getByText(/Hide.*subvolumes actions/);
screen.getByText(/Hide.*subvolume actions/);

// For now, we know that there are two lists and the subvolume list is the second one.
// The test could be simplified once we have aria-descriptions for the lists.
Expand Down
12 changes: 6 additions & 6 deletions web/src/components/storage/VolumeForm.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,14 @@ it("renders controls for setting the desired size", () => {
it("uses the default size unit when min size unit is missing", () => {
plainRender(<VolumeForm volume={{ ...volumes.home, minSize: "" }} />);

const maxSizeUnitSelector = screen.getByRole("combobox", { name: "Max size unit" });
const maxSizeUnitSelector = screen.getByRole("combobox", { name: "Unit for the maximum size" });
expect(maxSizeUnitSelector).toHaveValue(DEFAULT_SIZE_UNIT);
});

it("uses the min size unit as max size unit when it is missing", () => {
plainRender(<VolumeForm volume={{ ...volumes.home, minSize: "1 TiB" }} />);

const maxSizeUnitSelector = screen.getByRole("combobox", { name: "Max size unit" });
const maxSizeUnitSelector = screen.getByRole("combobox", { name: "Unit for the maximum size" });
expect(maxSizeUnitSelector).toHaveValue("TiB");
});

Expand Down Expand Up @@ -144,10 +144,10 @@ it("calls the onSubmit callback with resulting volume when the form is submitted
await user.click(rangeSize);

const minSizeInput = screen.getByRole("textbox", { name: "Minimum desired size" });
const minSizeUnitSelector = screen.getByRole("combobox", { name: "Min size unit" });
const minSizeUnitSelector = screen.getByRole("combobox", { name: "Unit for the minimum size" });
const minSizeGiBUnit = within(minSizeUnitSelector).getByRole("option", { name: "GiB" });
const maxSizeInput = screen.getByRole("textbox", { name: "Maximum desired size" });
const maxSizeUnitSelector = screen.getByRole("combobox", { name: "Max size unit" });
const maxSizeUnitSelector = screen.getByRole("combobox", { name: "Unit for the maximum size" });
const maxSizeGiBUnit = within(maxSizeUnitSelector).getByRole("option", { name: "GiB" });

await user.clear(minSizeInput);
Expand Down Expand Up @@ -216,10 +216,10 @@ describe("size validations", () => {
await user.click(rangeSize);

const minSizeInput = screen.getByRole("textbox", { name: "Minimum desired size" });
const minSizeUnitSelector = screen.getByRole("combobox", { name: "Min size unit" });
const minSizeUnitSelector = screen.getByRole("combobox", { name: "Unit for the minimum size" });
const minSizeMiBUnit = within(minSizeUnitSelector).getByRole("option", { name: "MiB" });
const maxSizeInput = screen.getByRole("textbox", { name: "Maximum desired size" });
const maxSizeUnitSelector = screen.getByRole("combobox", { name: "Max size unit" });
const maxSizeUnitSelector = screen.getByRole("combobox", { name: "Unit for the maximum size" });
const maxSizeGiBUnit = within(maxSizeUnitSelector).getByRole("option", { name: "GiB" });
const maxSizeMiBUnit = within(maxSizeUnitSelector).getByRole("option", { name: "MiB" });

Expand Down

0 comments on commit 13b3041

Please sign in to comment.