Skip to content

Commit

Permalink
Update test
Browse files Browse the repository at this point in the history
  • Loading branch information
lslezak committed Oct 9, 2023
1 parent 4ffed90 commit e8ff8e9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ jobs:
- name: Run Stylelint
run: npm run stylelint

- name: Run the tests
run: npm test -- SoftwarePage

- name: Run the tests and generate coverage report
run: npm test -- --coverage

Expand Down
28 changes: 14 additions & 14 deletions web/src/components/software/SoftwarePage.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,26 @@
*/

import React from "react";

import { act, screen } from "@testing-library/react";
import { installerRender, mockComponent } from "~/test-utils";
import { installerRender } from "~/test-utils";
import { BUSY, IDLE } from "~/client/status";

import { createClient } from "~/client";

import SoftwarePage from "./SoftwarePage";

const PatternSelectorMock = "<PatternSelector/> Mock";
jest.mock("~/components/software/PatternSelector", () => mockComponent(PatternSelectorMock));
const SkeletonMock = "Skeleton mock";
jest.mock("@patternfly/react-core", () => {
const original = jest.requireActual("@patternfly/react-core");

return {
...original,
Skeleton: () => { return <span>{SkeletonMock}</span> }
};
});

const PatternSelectorMock = "PatternSelector mock";
jest.mock("~/components/software/PatternSelector", () => () => { return PatternSelectorMock });
jest.mock("~/client");
const getStatusFn = jest.fn();
const onStatusChangeFn = jest.fn();
Expand All @@ -44,16 +54,6 @@ beforeEach(() => {
});
});

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

return {
...original,
Skeleton: mockComponent(SkeletonMock)
};
});

describe("SoftwarePage", () => {
it("displays a progress when the backend in busy", async () => {
getStatusFn.mockResolvedValue(BUSY);
Expand Down

0 comments on commit e8ff8e9

Please sign in to comment.