Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
534cf59
Add tests for searched device menu (ai)
joseivanlopez Dec 3, 2025
ab307fc
Fix drive editor tests (ai)
joseivanlopez Dec 3, 2025
3c0d08e
Add tests for device editor content (ai)
joseivanlopez Dec 3, 2025
d174306
Add tests for unused menu (ai)
joseivanlopez Dec 3, 2025
aaa6345
Add tests for filesystem menu (ai)
joseivanlopez Dec 3, 2025
e72ecd0
Fix partitions section tests (ai)
joseivanlopez Dec 3, 2025
a1447f3
Add tests for space policy menu (ai)
joseivanlopez Dec 3, 2025
6012cb6
Fix space policy menu tests
joseivanlopez Dec 3, 2025
63f2f95
Add tests for auto size text (ai)
joseivanlopez Dec 3, 2025
68b6d72
Fix types (ai)
joseivanlopez Dec 3, 2025
cf32e69
Fix eslint (ai)
joseivanlopez Dec 3, 2025
6b18989
Add tests for boot section (ai)
joseivanlopez Dec 4, 2025
02cdce5
Fix connected devices menu tests (ai)
joseivanlopez Dec 4, 2025
4b710cc
Fix partition page tests (ai)
joseivanlopez Dec 4, 2025
e85f041
Fix config editor tests (ai)
joseivanlopez Dec 4, 2025
2d0c98e
Fix proposal page tests (ai)
joseivanlopez Dec 4, 2025
0af376f
Add tests for menu device description (ai)
joseivanlopez Dec 5, 2025
2e71fe2
Fix formattable device page tests (ai)
joseivanlopez Dec 5, 2025
ccb9186
Add tests for logical volume page (ai)
joseivanlopez Dec 5, 2025
dab7f1b
Add more tests for space actions table (ai)
joseivanlopez Dec 5, 2025
78a7bd9
Fix lvm page tests (ai)
joseivanlopez Dec 5, 2025
06d188f
Fix device selector model (ai)
joseivanlopez Dec 5, 2025
1cc6ea3
Fix configure device menu tests (ai)
joseivanlopez Dec 5, 2025
f3e2517
Fix proposal failed info tests (ai)
joseivanlopez Dec 5, 2025
22c388e
Fix encryption settings page tests (ai)
joseivanlopez Dec 5, 2025
d51e91a
Fix proposal transactional info test (ai)
joseivanlopez Dec 5, 2025
a015049
Fix unsupported model info tests (ai)
joseivanlopez Dec 5, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions web/src/components/core/ChangeProductOption.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import React from "react";
import { screen } from "@testing-library/react";
import { installerRender } from "~/test-utils";
import { useSystem } from "~/hooks/api";
import { useSystem } from "~/hooks/api/system";
import { PRODUCT as PATHS } from "~/routes/paths";
import { Product } from "~/types/software";
import ChangeProductOption from "./ChangeProductOption";
Expand Down Expand Up @@ -59,8 +59,8 @@ const network: System = {
// let registrationInfoMock: RegistrationInfo;
const mockSystemProducts: jest.Mock<Product[]> = jest.fn();

jest.mock("~/hooks/api", () => ({
...jest.requireActual("~/hooks/api"),
jest.mock("~/hooks/api/system", () => ({
...jest.requireActual("~/hooks/api/system"),
useSystem: (): ReturnType<typeof useSystem> => ({
products: mockSystemProducts(),
network,
Expand Down
10 changes: 3 additions & 7 deletions web/src/components/core/InstallButton.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { screen, waitFor, within } from "@testing-library/react";
import { installerRender, mockRoutes } from "~/test-utils";
import { InstallButton } from "~/components/core";
import { PRODUCT, ROOT } from "~/routes/paths";
import { Issue, IssueSeverity, IssueSource } from "~/api/issue";
import { Issue } from "~/api/issue";

const mockStartInstallationFn = jest.fn();
let mockIssuesList: Issue[];
Expand Down Expand Up @@ -55,9 +55,7 @@ describe("InstallButton", () => {
mockIssuesList = [
{
description: "Fake Issue",
kind: "generic",
source: IssueSource.Unknown,
severity: IssueSeverity.Error,
class: "error",
details: "Fake Issue details",
scope: "product",
},
Expand Down Expand Up @@ -133,9 +131,7 @@ describe("InstallButton", () => {
mockIssuesList = [
{
description: "Fake warning",
kind: "generic",
source: IssueSource.Unknown,
severity: IssueSeverity.Warn,
class: "warn",
details: "Fake Issue details",
scope: "product",
},
Expand Down
4 changes: 2 additions & 2 deletions web/src/components/core/InstallationFinished.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ const mockStorageConfig = (
}
};

jest.mock("~/queries/storage", () => ({
...jest.requireActual("~/queries/storage"),
jest.mock("~/hooks/api/config/storage", () => ({
...jest.requireActual("~/hooks/api/config/storage"),
useConfig: () => mockStorageConfig(mockType, mockEncryption),
}));

Expand Down
10 changes: 3 additions & 7 deletions web/src/components/core/IssuesAlert.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,14 @@ import React from "react";
import { screen } from "@testing-library/react";
import { installerRender } from "~/test-utils";
import { IssuesAlert } from "~/components/core";
import { Issue, IssueSeverity, IssueSource } from "~/api/issue";
import { Issue } from "~/api/issue";
import { SOFTWARE } from "~/routes/paths";

describe("IssueAlert", () => {
it("renders a list of issues", () => {
const issue: Issue = {
description: "A generic issue",
source: IssueSource.Config,
severity: IssueSeverity.Error,
kind: "generic",
class: "generic",
scope: "software",
};
installerRender(<IssuesAlert issues={[issue]} />);
Expand All @@ -43,9 +41,7 @@ describe("IssueAlert", () => {
it("renders a link to conflict resolution when there is a 'solver' issue", () => {
const issue: Issue = {
description: "Conflicts found",
source: IssueSource.Config,
severity: IssueSeverity.Error,
kind: "solver",
class: "solver",
scope: "software",
};
installerRender(<IssuesAlert issues={[issue]} />);
Expand Down
37 changes: 14 additions & 23 deletions web/src/components/core/IssuesDrawer.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ import React from "react";
import { screen, within } from "@testing-library/react";
import { installerRender } from "~/test-utils";
import { InstallationPhase } from "~/types/status";
import { Issue, IssueSeverity, IssueSource } from "~/api/issue";
import { Issue } from "~/api/issue";
import IssuesDrawer from "./IssuesDrawer";

let phase = InstallationPhase.Config;
let mockIssuesList: Issue[];
const onCloseFn = jest.fn();

jest.mock("~/queries/issues", () => ({
...jest.requireActual("~/queries/issues"),
useAllIssues: () => mockIssuesList,
jest.mock("~/hooks/api/issue", () => ({
...jest.requireActual("~/hooks/api/issue"),
useIssues: () => mockIssuesList,
}));

jest.mock("~/queries/status", () => ({
Expand Down Expand Up @@ -62,58 +62,49 @@ describe("IssuesDrawer", () => {
mockIssuesList = [
{
description: "Registration Fake Warning",
kind: "generic",
source: IssueSource.Unknown,
severity: IssueSeverity.Warn,
class: "warn",
details: "Registration Fake Issue details",
scope: "product",
},
];
});

itRendersNothing();
it("renders the drawer with a warning", () => {
installerRender(<IssuesDrawer onClose={onCloseFn} />);
expect(screen.getByText("Registration Fake Warning")).toBeInTheDocument();
});
});

describe("when there are installation issues", () => {
beforeEach(() => {
mockIssuesList = [
{
description: "Registration Fake Issue",
kind: "generic",
source: IssueSource.Unknown,
severity: IssueSeverity.Error,
class: "error",
details: "Registration Fake Issue details",
scope: "product",
},
{
description: "Software Fake Issue",
kind: "generic",
source: IssueSource.Unknown,
severity: IssueSeverity.Error,
class: "error",
details: "Software Fake Issue details",
scope: "software",
},
{
description: "Storage Fake Issue 1",
kind: "generic",
source: IssueSource.Unknown,
severity: IssueSeverity.Error,
class: "error",
details: "Storage Fake Issue 1 details",
scope: "storage",
},
{
description: "Storage Fake Issue 2",
kind: "generic",
source: IssueSource.Unknown,
severity: IssueSeverity.Error,
class: "error",
details: "Storage Fake Issue 2 details",
scope: "storage",
},
{
description: "Users Fake Issue",
kind: "generic",
source: IssueSource.Unknown,
severity: IssueSeverity.Error,
class: "error",
details: "Users Fake Issue details",
scope: "users",
},
Expand Down
6 changes: 3 additions & 3 deletions web/src/components/core/ProgressStatusMonitor.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
import React from "react";
import { screen, within } from "@testing-library/react";
import { installerRender } from "~/test-utils";
import { useStatus } from "~/hooks/api";
import { useStatus } from "~/hooks/api/status";
import ProgressStatusMonitor from "./ProgressStatusMonitor";

let mockProgress: jest.Mock<ReturnType<typeof useStatus>["progresses"]> = jest.fn();
const mockProgress: jest.Mock<ReturnType<typeof useStatus>["progresses"]> = jest.fn();

jest.mock("~/hooks/api", () => ({
jest.mock("~/hooks/api/status", () => ({
useStatus: () => ({ progresses: mockProgress() }),
}));

Expand Down
2 changes: 1 addition & 1 deletion web/src/components/core/SelectableDataTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export type SelectableDataTableColumn = {
* If defined, marks the column as sortable and specifies the key used for
* sorting.
*/
sortingKey?: string;
sortingKey?: string | ((item: object) => string | number);

/**
* A space-separated string of additional CSS class names to apply to the column's cells.
Expand Down
30 changes: 15 additions & 15 deletions web/src/components/network/WifiConnectionForm.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,21 @@ import { Connection, SecurityProtocols, WifiNetworkStatus, Wireless } from "~/ty

const mockUpdateConnection = jest.fn();

const mockConnection = new Connection("Visible Network", {
wireless: new Wireless({ ssid: "Visible Network" }),
});

const mockSystem = {
connections: [mockConnection],
state: {
connectivity: true,
wiredEnabled: true,
wirelessEnabled: false,
persistNetwork: true,
copyEnabled: false,
},
};

jest.mock("~/hooks/api/config/network", () => ({
...jest.requireActual("~/hooks/api/config/network"),
useConnectionMutation: () => ({
Expand All @@ -51,21 +66,6 @@ jest.mock("~/hooks/api/system/network", () => ({
useConnections: () => mockSystem.connections,
}));

const mockConnection = new Connection("Visible Network", {
wireless: new Wireless({ ssid: "Visible Network" }),
});

const mockSystem = {
connections: [mockConnection],
state: {
connectivity: true,
wiredEnabled: true,
wirelessEnabled: false,
persistNetwork: true,
copyEnabled: false,
},
};

const networkMock = {
ssid: "Visible Network",
hidden: false,
Expand Down
14 changes: 7 additions & 7 deletions web/src/components/overview/L10nSection.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,22 @@ import React from "react";
import { screen } from "@testing-library/react";
import { plainRender } from "~/test-utils";
import { L10nSection } from "~/components/overview";
import { Locale } from "~/api/system";
import type { Locale } from "~/api/system/l10n";

const locales: Locale[] = [
{ id: "en_US.UTF-8", name: "English", territory: "United States" },
{ id: "de_DE.UTF-8", name: "German", territory: "Germany" },
{ id: "en_US.UTF-8", language: "English", territory: "United States" },
{ id: "de_DE.UTF-8", language: "German", territory: "Germany" },
];

jest.mock("~/queries/system", () => ({
...jest.requireActual("~/queries/system"),
jest.mock("~/hooks/api/system", () => ({
...jest.requireActual("~/hooks/api/system"),
useSystem: () => ({
l10n: { locale: "en_US.UTF-8", locales, keymap: "us" },
}),
}));

jest.mock("~/queries/proposal", () => ({
...jest.requireActual("~/queries/proposal"),
jest.mock("~/hooks/api/proposal", () => ({
...jest.requireActual("~/hooks/api/proposal"),
useProposal: () => ({
l10n: { locale: "en_US.UTF-8", keymap: "us" },
}),
Expand Down
31 changes: 8 additions & 23 deletions web/src/components/overview/StorageSection.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import React from "react";
import { screen } from "@testing-library/react";
import { plainRender } from "~/test-utils";
import { StorageSection } from "~/components/overview";
import { IssueSeverity, IssueSource } from "~/api/issue";
import type { storage } from "~/api/system";

let mockModel = {
drives: [],
Expand Down Expand Up @@ -62,30 +62,18 @@ const sdb = {
udevPaths: [],
};

jest.mock("~/queries/storage/config-model", () => ({
...jest.requireActual("~/queries/storage/config-model"),
useConfigModel: () => mockModel,
jest.mock("~/hooks/api/storage", () => ({
useStorageModel: () => mockModel,
}));

const mockDevices = [sda, sdb];

jest.mock("~/queries/storage", () => ({
...jest.requireActual("~/queries/storage"),
useDevices: () => mockDevices,
}));

let mockAvailableDevices = [sda, sdb];
let mockSystemErrors: storage.Issue[] = [];

jest.mock("~/hooks/storage/system", () => ({
...jest.requireActual("~/hooks/storage/system"),
jest.mock("~/hooks/api/system/storage", () => ({
useDevices: () => mockDevices,
useAvailableDevices: () => mockAvailableDevices,
}));

let mockSystemErrors = [];

jest.mock("~/queries/issues", () => ({
...jest.requireActual("~/queries/issues"),
useSystemErrors: () => mockSystemErrors,
useIssues: () => mockSystemErrors,
}));

beforeEach(() => {
Expand Down Expand Up @@ -247,11 +235,8 @@ describe("when there is no configuration model (unsupported features)", () => {
mockSystemErrors = [
{
description: "System error",
kind: "storage",
class: "storage",
details: "",
source: IssueSource.System,
severity: IssueSeverity.Error,
scope: "storage",
},
];
});
Expand Down
10 changes: 5 additions & 5 deletions web/src/components/questions/LuksActivationQuestion.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { AnswerCallback, Question, FieldType } from "~/api/question";
import { InstallationPhase } from "~/types/status";
import { Product } from "~/types/software";
import LuksActivationQuestion from "~/components/questions/LuksActivationQuestion";
import { Locale, Keymap } from "~/api/system";
import type { Locale, Keymap } from "~/api/system/l10n";

let question: Question;
const questionMock: Question = {
Expand All @@ -51,12 +51,12 @@ const tumbleweed: Product = {
};

const locales: Locale[] = [
{ id: "en_US.UTF-8", name: "English", territory: "United States" },
{ id: "es_ES.UTF-8", name: "Spanish", territory: "Spain" },
{ id: "en_US.UTF-8", language: "English", territory: "United States" },
{ id: "es_ES.UTF-8", language: "Spanish", territory: "Spain" },
];
const keymaps: Keymap[] = [
{ id: "us", name: "English" },
{ id: "es", name: "Spanish" },
{ id: "us", description: "English" },
{ id: "es", description: "Spanish" },
];

jest.mock("~/queries/system", () => ({
Expand Down
10 changes: 5 additions & 5 deletions web/src/components/questions/QuestionWithPassword.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { Question, FieldType } from "~/api/question";
import { Product } from "~/types/software";
import { InstallationPhase } from "~/types/status";
import QuestionWithPassword from "~/components/questions/QuestionWithPassword";
import { Locale, Keymap } from "~/api/system";
import type { Locale, Keymap } from "~/api/system/l10n";

const answerFn = jest.fn();
const question: Question = {
Expand All @@ -51,13 +51,13 @@ const tumbleweed: Product = {
};

const locales: Locale[] = [
{ id: "en_US.UTF-8", name: "English", territory: "United States" },
{ id: "es_ES.UTF-8", name: "Spanish", territory: "Spain" },
{ id: "en_US.UTF-8", language: "English", territory: "United States" },
{ id: "es_ES.UTF-8", language: "Spanish", territory: "Spain" },
];

const keymaps: Keymap[] = [
{ id: "us", name: "English" },
{ id: "es", name: "Spanish" },
{ id: "us", description: "English" },
{ id: "es", description: "Spanish" },
];

jest.mock("~/queries/status", () => ({
Expand Down
Loading
Loading