Skip to content

Commit

Permalink
Update dependencies and replace deprecated act method in tests (PR #5760
Browse files Browse the repository at this point in the history
)

# Description

Update dependencies and move act method to React.
  • Loading branch information
LukasStordeur authored and inmantaci committed May 31, 2024
1 parent 6c60de6 commit 5f1b597
Show file tree
Hide file tree
Showing 97 changed files with 444 additions and 1,077 deletions.
4 changes: 4 additions & 0 deletions changelogs/unreleased/update-dependencies.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
description: "Update dependencies and replace deprecated act method in tests"
change-type: patch
destination-branches: [master, iso7]

2 changes: 1 addition & 1 deletion cypress/e2e/scenario-8-instance-composer.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ if (Cypress.env("edition") === "iso") {
cy.get(".canvas").should("be.visible");
cy.get('[data-type="app.ServiceEntityBlock"]').should("be.visible");
cy.get('[joint-selector="headerLabel"]')
.contains("embedded-entity-")
.contains("embedded-")
.should("exist");
cy.get('[joint-selector="headerLabel"]')
.contains("ro_meta")
Expand Down
17 changes: 8 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
],
"type": "module",
"devDependencies": {
"@babel/core": "^7.24.4",
"@babel/plugin-transform-typescript": "^7.23.6",
"@babel/core": "^7.24.5",
"@babel/plugin-transform-typescript": "^7.24.5",
"@testing-library/dom": "^9.3.4",
"@testing-library/jest-dom": "^6.4.2",
"@testing-library/react": "^15.0.7",
Expand All @@ -62,15 +62,15 @@
"@types/jest": "^29.5.12",
"@types/jest-axe": "^3.5.9",
"@types/json-bigint": "^1.0.3",
"@types/loadable__component": "^5",
"@types/loadable__component": "^5.13.9",
"@types/lodash": "^4.17.4",
"@types/lodash-es": "^4.17.12",
"@types/node": "^20.11.5",
"@types/qs": "^6.9.11",
"@types/node": "^20.12.12",
"@types/qs": "^6.9.15",
"@types/react-dom": "^18.3.0",
"@types/react-router-dom": "^5.3.3",
"@types/react-syntax-highlighter": "^15.5.10",
"@types/react-test-renderer": "^18",
"@types/react-test-renderer": "^18.3.0",
"@types/styled-components": "^5.1.26",
"@types/uuid": "^9",
"@types/webpack": "^5.28.5",
Expand Down Expand Up @@ -103,7 +103,7 @@
"imagemin": "^8.0.1",
"jest": "^29.7.0",
"jest-axe": "^8.0.0",
"jest-environment-jsdom": "^29.6.4",
"jest-environment-jsdom": "^29.7.0",
"jest-fetch-mock": "^3.0.3",
"jest-junit": "^16.0.0",
"lint-staged": "^15.2.0",
Expand All @@ -122,7 +122,7 @@
"rimraf": "^5.0.5",
"style-loader": "^4.0.0",
"svg-url-loader": "^8.0.0",
"ts-jest": "^29.1.1",
"ts-jest": "^29.1.3",
"ts-loader": "^9.5.1",
"ts-prune": "^0.10.3",
"tsconfig-paths-webpack-plugin": "^4.1.0",
Expand Down Expand Up @@ -182,7 +182,6 @@
"resolutions": {
"json5": "^2.2.2",
"terser-webpack-plugin": "^1.4.5",
"@types/react": "^18.0.21",
"prismjs": "^1.25.0",
"trim": "^0.0.3",
"glob-parent": "^5.1.2",
Expand Down
4 changes: 2 additions & 2 deletions src/Data/Managers/GetInstanceResources/QueryManager.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useContext } from "react";
import { act, render, screen } from "@testing-library/react";
import React, { useContext, act } from "react";
import { render, screen } from "@testing-library/react";
import { StoreProvider } from "easy-peasy";
import { Either, PageSize, RemoteData } from "@/Core";
import { initialCurrentPage } from "@/Data/Common/UrlState/useUrlStateWithCurrentPage";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useContext } from "react";
import React, { useContext, act } from "react";
import { MemoryRouter, useLocation, useNavigate } from "react-router-dom";
import { act, render, screen } from "@testing-library/react";
import { render, screen } from "@testing-library/react";
import { userEvent } from "@testing-library/user-event";
import { StoreProvider } from "easy-peasy";
import { Either, RemoteData } from "@/Core";
Expand Down
4 changes: 2 additions & 2 deletions src/Data/Managers/ServiceInstances/QueryManager.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import React, { act } from "react";
import { MemoryRouter } from "react-router-dom";
import { act, render, screen } from "@testing-library/react";
import { render, screen } from "@testing-library/react";
import { userEvent } from "@testing-library/user-event";
import { StoreProvider } from "easy-peasy";
import {
Expand Down
4 changes: 2 additions & 2 deletions src/Slices/AgentProcess/UI/Page.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import React, { act } from "react";
import { MemoryRouter } from "react-router-dom";
import { act, render, screen } from "@testing-library/react";
import { render, screen } from "@testing-library/react";
import { StoreProvider } from "easy-peasy";
import { configureAxe, toHaveNoViolations } from "jest-axe";
import { Either } from "@/Core";
Expand Down
4 changes: 2 additions & 2 deletions src/Slices/Agents/UI/Agents.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import React, { act } from "react";
import { MemoryRouter } from "react-router-dom";
import { act, render, screen, within } from "@testing-library/react";
import { render, screen, within } from "@testing-library/react";
import { userEvent } from "@testing-library/user-event";
import { StoreProvider } from "easy-peasy";
import { configureAxe, toHaveNoViolations } from "jest-axe";
Expand Down
4 changes: 2 additions & 2 deletions src/Slices/CompileDetails/UI/CompileDetails.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import React, { act } from "react";
import { MemoryRouter } from "react-router-dom";
import { act, render, screen } from "@testing-library/react";
import { render, screen } from "@testing-library/react";
import { StoreProvider } from "easy-peasy";
import { configureAxe, toHaveNoViolations } from "jest-axe";
import { Either } from "@/Core";
Expand Down
4 changes: 2 additions & 2 deletions src/Slices/CompileReports/UI/Page.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import React, { act } from "react";
import { MemoryRouter } from "react-router-dom";
import { act, render, screen, within } from "@testing-library/react";
import { render, screen, within } from "@testing-library/react";
import { userEvent } from "@testing-library/user-event";
import { StoreProvider } from "easy-peasy";
import { configureAxe, toHaveNoViolations } from "jest-axe";
Expand Down
4 changes: 2 additions & 2 deletions src/Slices/ComplianceCheck/UI/Page.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import { act, render, screen } from "@testing-library/react";
import React, { act } from "react";
import { render, screen } from "@testing-library/react";
import { userEvent } from "@testing-library/user-event";
import { StoreProvider } from "easy-peasy";
import { configureAxe, toHaveNoViolations } from "jest-axe";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import React, { act } from "react";
import { MemoryRouter } from "react-router";
import { act, render, screen } from "@testing-library/react";
import { render, screen } from "@testing-library/react";
import { userEvent } from "@testing-library/user-event";
import { StoreProvider } from "easy-peasy";
import { configureAxe, toHaveNoViolations } from "jest-axe";
Expand Down
4 changes: 2 additions & 2 deletions src/Slices/CreateInstance/UI/CreateInstance.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import React, { act } from "react";
import { MemoryRouter } from "react-router-dom";
import { render, screen, act, within } from "@testing-library/react";
import { render, screen, within } from "@testing-library/react";
import { userEvent } from "@testing-library/user-event";
import { StoreProvider } from "easy-peasy";
import { configureAxe, toHaveNoViolations } from "jest-axe";
Expand Down
4 changes: 2 additions & 2 deletions src/Slices/Dashboard/UI/GraphCard.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import { act, render, screen } from "@testing-library/react";
import React, { act } from "react";
import { render, screen } from "@testing-library/react";
import { configureAxe, toHaveNoViolations } from "jest-axe";
import { words } from "@/UI";
import { MetricName } from "../Core/Domain";
Expand Down
4 changes: 2 additions & 2 deletions src/Slices/Dashboard/UI/Page.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import React, { act } from "react";
import { MemoryRouter } from "react-router";
import { act, render, screen } from "@testing-library/react";
import { render, screen } from "@testing-library/react";
import { StoreProvider } from "easy-peasy";
import { configureAxe, toHaveNoViolations } from "jest-axe";
import { Either } from "@/Core";
Expand Down
4 changes: 2 additions & 2 deletions src/Slices/DesiredState/UI/Page.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import React, { act } from "react";
import { MemoryRouter } from "react-router-dom";
import { act, render, screen, within } from "@testing-library/react";
import { render, screen, within } from "@testing-library/react";
import { userEvent } from "@testing-library/user-event";
import { StoreProvider } from "easy-peasy";
import { configureAxe, toHaveNoViolations } from "jest-axe";
Expand Down
4 changes: 2 additions & 2 deletions src/Slices/DesiredStateCompare/UI/Page.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import { act, render, screen, within } from "@testing-library/react";
import React, { act } from "react";
import { render, screen, within } from "@testing-library/react";
import { userEvent } from "@testing-library/user-event";
import { StoreProvider } from "easy-peasy";
import { configureAxe, toHaveNoViolations } from "jest-axe";
Expand Down
3 changes: 1 addition & 2 deletions src/Slices/DesiredStateDetails/UI/Page.test.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import React from "react";
import React, { act } from "react";
import { MemoryRouter } from "react-router-dom";
import { render, screen } from "@testing-library/react";
import { StoreProvider } from "easy-peasy";
import { configureAxe, toHaveNoViolations } from "jest-axe";
import { act } from "react-dom/test-utils";
import { Either } from "@/Core";
import { getStoreInstance, QueryResolverImpl } from "@/Data";
import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import React from "react";
import React, { act } from "react";
import { MemoryRouter } from "react-router-dom";
import { render, screen } from "@testing-library/react";
import { StoreProvider } from "easy-peasy";
import { configureAxe, toHaveNoViolations } from "jest-axe";
import { act } from "react-dom/test-utils";
import { Either } from "@/Core";
import {
getStoreInstance,
Expand Down
4 changes: 2 additions & 2 deletions src/Slices/Diagnose/UI/Diagnose.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import React, { act } from "react";
import { MemoryRouter } from "react-router-dom";
import { act, render, screen } from "@testing-library/react";
import { render, screen } from "@testing-library/react";
import { StoreProvider } from "easy-peasy";
import { configureAxe, toHaveNoViolations } from "jest-axe";
import { Either } from "@/Core";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import React, { act } from "react";
import { MemoryRouter } from "react-router-dom";
import { act, render, screen, within } from "@testing-library/react";
import { render, screen, within } from "@testing-library/react";
import { userEvent } from "@testing-library/user-event";
import { StoreProvider } from "easy-peasy";
import { configureAxe, toHaveNoViolations } from "jest-axe";
Expand Down
4 changes: 2 additions & 2 deletions src/Slices/EditInstance/UI/EditInstancePage.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import React, { act } from "react";
import { MemoryRouter } from "react-router-dom";
import { act, render, screen, within } from "@testing-library/react";
import { render, screen, within } from "@testing-library/react";
import { userEvent } from "@testing-library/user-event";
import { StoreProvider } from "easy-peasy";
import { configureAxe, toHaveNoViolations } from "jest-axe";
Expand Down
4 changes: 2 additions & 2 deletions src/Slices/Events/UI/Events.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import React, { act } from "react";
import { MemoryRouter } from "react-router";
import { act, render, screen } from "@testing-library/react";
import { render, screen } from "@testing-library/react";
import { StoreProvider } from "easy-peasy";
import { configureAxe, toHaveNoViolations } from "jest-axe";
import { Either, InstanceEvent } from "@/Core";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { render, screen, act, within } from "@testing-library/react";
import { act } from "react";
import { render, screen, within } from "@testing-library/react";
import { userEvent } from "@testing-library/user-event";
import { Either } from "@/Core";
import { Service, Pagination } from "@/Test";
Expand Down Expand Up @@ -89,6 +90,7 @@ describe("Given the Events Page", () => {
expect(rowsAfter).toHaveLength(3);
},
);

it("When using the Date filter then the events with from and to the events in the range should be fetched and shown", async () => {
const { component, apiHelper } = new EventsPageComposer().compose(
Service.a,
Expand Down Expand Up @@ -247,7 +249,9 @@ describe("Given the Events Page", () => {

// The chips are hidden in small windows, so resize it
window = Object.assign(window, { innerWidth: 1200 });
window.dispatchEvent(new Event("resize"));
await act(async () => {
window.dispatchEvent(new Event("resize"));
});

expect(await screen.findByText(chip, { exact: false })).toBeVisible();
await act(async () => {
Expand Down
4 changes: 2 additions & 2 deletions src/Slices/Facts/UI/Page.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import React, { act } from "react";
import { MemoryRouter } from "react-router-dom";
import { act, render, screen, within } from "@testing-library/react";
import { render, screen, within } from "@testing-library/react";
import { userEvent } from "@testing-library/user-event";
import { StoreProvider } from "easy-peasy";
import { axe, toHaveNoViolations } from "jest-axe";
Expand Down
4 changes: 2 additions & 2 deletions src/Slices/Home/UI/EnvironmentsOverview.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import React, { act } from "react";
import { MemoryRouter } from "react-router-dom";
import { act, render, screen } from "@testing-library/react";
import { render, screen } from "@testing-library/react";
import { userEvent } from "@testing-library/user-event";
import { dependencies, Environment } from "@/Test";
import { words } from "@/UI";
Expand Down
4 changes: 2 additions & 2 deletions src/Slices/Home/UI/Page.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import React, { act } from "react";
import { MemoryRouter } from "react-router";
import { act, render, screen } from "@testing-library/react";
import { render, screen } from "@testing-library/react";
import { StoreProvider } from "easy-peasy";
import { configureAxe, toHaveNoViolations } from "jest-axe";
import { Either } from "@/Core";
Expand Down
4 changes: 2 additions & 2 deletions src/Slices/Login/Page.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import React, { act } from "react";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { screen } from "@testing-library/dom";
import { act, render, waitFor } from "@testing-library/react";
import { render, waitFor } from "@testing-library/react";
import { userEvent } from "@testing-library/user-event";
import { axe, toHaveNoViolations } from "jest-axe";
import { HttpResponse, http } from "msw";
Expand Down
4 changes: 2 additions & 2 deletions src/Slices/Notification/UI/Badge/Badge.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import { act, render, screen } from "@testing-library/react";
import React, { act } from "react";
import { render, screen } from "@testing-library/react";
import { StoreProvider } from "easy-peasy";
import { Either } from "@/Core";
import {
Expand Down
4 changes: 2 additions & 2 deletions src/Slices/Notification/UI/Center/Page.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import React, { act } from "react";
import { MemoryRouter } from "react-router-dom";
import { act, render, screen } from "@testing-library/react";
import { render, screen } from "@testing-library/react";
import { userEvent } from "@testing-library/user-event";
import { StoreProvider } from "easy-peasy";
import { axe, toHaveNoViolations } from "jest-axe";
Expand Down
4 changes: 2 additions & 2 deletions src/Slices/Notification/UI/Drawer/Drawer.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import React, { act } from "react";
import { Router } from "react-router-dom";
import { Masthead, Page } from "@patternfly/react-core";
import { act, render, screen, within } from "@testing-library/react";
import { render, screen, within } from "@testing-library/react";
import { userEvent } from "@testing-library/user-event";
import { StoreProvider } from "easy-peasy";
import { createMemoryHistory } from "history";
Expand Down
4 changes: 2 additions & 2 deletions src/Slices/OrderDetails/UI/Page.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import { act, render, screen } from "@testing-library/react";
import React, { act } from "react";
import { render, screen } from "@testing-library/react";
import { userEvent } from "@testing-library/user-event";
import { axe, toHaveNoViolations } from "jest-axe";
import { Either } from "@/Core";
Expand Down
4 changes: 2 additions & 2 deletions src/Slices/Orders/UI/Page.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from "react";
import { act, render, screen } from "@testing-library/react";
import React, { act } from "react";
import { render, screen } from "@testing-library/react";
import { axe, toHaveNoViolations } from "jest-axe";
import { Either } from "@/Core";
import { baseSetup } from "@/Test/Utils/base-setup";
Expand Down
4 changes: 2 additions & 2 deletions src/Slices/Parameters/UI/Page.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import React, { act } from "react";
import { MemoryRouter } from "react-router-dom";
import { act, render, screen, within } from "@testing-library/react";
import { render, screen, within } from "@testing-library/react";
import { userEvent } from "@testing-library/user-event";
import { StoreProvider } from "easy-peasy";
import { axe, toHaveNoViolations } from "jest-axe";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState } from "react";
import React, { useState, act } from "react";
import { Toolbar, ToolbarContent, ToolbarItem } from "@patternfly/react-core";
import { act, fireEvent, render, screen } from "@testing-library/react";
import { fireEvent, render, screen } from "@testing-library/react";
import { Resource } from "@/Core";
import { DeployStateFilter } from "./DeployStateFilter";

Expand Down
4 changes: 2 additions & 2 deletions src/Slices/Resource/UI/ResourcesPage/Page.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import React, { act } from "react";
import { MemoryRouter } from "react-router-dom";
import { act, render, screen, within } from "@testing-library/react";
import { render, screen, within } from "@testing-library/react";
import { userEvent } from "@testing-library/user-event";
import { StoreProvider } from "easy-peasy";
import { configureAxe, toHaveNoViolations } from "jest-axe";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import React, { act } from "react";
import { MemoryRouter } from "react-router";
import { act, render, screen } from "@testing-library/react";
import { render, screen } from "@testing-library/react";
import { userEvent } from "@testing-library/user-event";
import { StoreProvider } from "easy-peasy";
import { Either, RemoteData } from "@/Core";
Expand Down
Loading

0 comments on commit 5f1b597

Please sign in to comment.