Skip to content

Commit

Permalink
chore(web): add a unit test for the storage warning
Browse files Browse the repository at this point in the history
  • Loading branch information
imobachgs committed Jan 10, 2025
1 parent 7c4454a commit 4806ad0
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions web/src/components/overview/StorageSection.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,30 @@ const mockAvailableDevices = [
];

const mockResultSettings = { target: "disk", targetDevice: "/dev/sda", spacePolicy: "delete" };
let mockProposalResult;

jest.mock("~/queries/storage", () => ({
...jest.requireActual("~/queries/storage"),
useAvailableDevices: () => mockAvailableDevices,
useProposalResult: () => ({
useProposalResult: () => mockProposalResult,
}));

beforeEach(() => {
mockProposalResult = {
settings: mockResultSettings,
actions: [],
}),
}));
};
});

describe("when using the new storage settings", () => {
beforeEach(() => (mockProposalResult = undefined));

it("renders a warning message", () => {
plainRender(<StorageSection />);

expect(screen.getByText("Install using an advanced configuration.")).toBeInTheDocument();
});
});

describe("when there is a proposal", () => {
beforeEach(() => {
Expand Down

0 comments on commit 4806ad0

Please sign in to comment.