Skip to content

Commit

Permalink
web: Fix more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
joseivanlopez committed Apr 12, 2024
1 parent 0ed651e commit 2b616f4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions web/src/components/core/Field.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ describe("Field", () => {
});

describe("SettingsField", () => {
it("uses the 'settings' icon", () => {
it("uses the 'shadow' icon", () => {
const { container } = plainRender(
// Trying to set other icon, although typechecking should catch it.
<SettingsField icon="edit" label="Theme" value="dark" onClick={onClick} />
);
const icon = container.querySelector("button > svg");
expect(icon).toHaveAttribute("data-icon-name", "settings");
expect(icon).toHaveAttribute("data-icon-name", "shadow");
});
});

Expand Down
18 changes: 9 additions & 9 deletions web/src/components/storage/InstallationDeviceField.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

import React from "react";
import { screen, within } from "@testing-library/react";
import { plainRender } from "~/test-utils";
import { installerRender } from "~/test-utils";
import InstallationDeviceField from "~/components/storage/InstallationDeviceField";

/**
Expand Down Expand Up @@ -97,7 +97,7 @@ describe("when set as loading", () => {
});

it("renders a loading hint", () => {
plainRender(<InstallationDeviceField {...props} />);
installerRender(<InstallationDeviceField {...props} />);
screen.getByText("Waiting for information about selected device");
});
});
Expand All @@ -113,7 +113,7 @@ describe("when the target is a disk", () => {
});

it("uses a 'No device selected yet' text for the selection button", async () => {
plainRender(<InstallationDeviceField {...props} />);
installerRender(<InstallationDeviceField {...props} />);
screen.getByText("No device selected yet");
});
});
Expand All @@ -124,7 +124,7 @@ describe("when the target is a disk", () => {
});

it("uses its name as part of the text for the selection button", async () => {
plainRender(<InstallationDeviceField {...props} />);
installerRender(<InstallationDeviceField {...props} />);
screen.getByText(/\/dev\/sda/);
});
});
Expand All @@ -141,7 +141,7 @@ describe("when the target is a new LVM volume group", () => {
});

it("uses a 'No device selected yet' text for the selection button", async () => {
plainRender(<InstallationDeviceField {...props} />);
installerRender(<InstallationDeviceField {...props} />);
screen.getByText("No device selected yet");
});
});
Expand All @@ -152,7 +152,7 @@ describe("when the target is a new LVM volume group", () => {
});

it("uses its name as part of the text for the selection button", async () => {
plainRender(<InstallationDeviceField {...props} />);
installerRender(<InstallationDeviceField {...props} />);
screen.getByText(/new LVM .* \/dev\/sda/);
});
});
Expand All @@ -163,14 +163,14 @@ describe("when the target is a new LVM volume group", () => {
});

it("does not use the names as part of the text for the selection button", async () => {
plainRender(<InstallationDeviceField {...props} />);
installerRender(<InstallationDeviceField {...props} />);
screen.getByText("new LVM volume group");
});
});
});

it("allows changing the selected device", async () => {
const { user } = plainRender(<InstallationDeviceField {...props} />);
const { user } = installerRender(<InstallationDeviceField {...props} />);
const button = screen.getByRole("button", { name: /installation device/i });

await user.click(button);
Expand All @@ -193,7 +193,7 @@ it("allows changing the selected device", async () => {
});

it("allows canceling a device selection", async () => {
const { user } = plainRender(<InstallationDeviceField {...props} />);
const { user } = installerRender(<InstallationDeviceField {...props} />);
const button = screen.getByRole("button", { name: /installation device/i });

await user.click(button);
Expand Down

0 comments on commit 2b616f4

Please sign in to comment.