From 5bf60d0b5097f8af088fa6271fc2621263228433 Mon Sep 17 00:00:00 2001 From: Paul Schreiber Date: Mon, 29 Apr 2024 16:00:22 -0400 Subject: [PATCH] style: reformat code after import change --- src/account/components/AccountProfile.test.js | 3 +-- src/contact/ContactForm.test.js | 3 +-- src/group/components/GroupForm.test.js | 3 +-- src/group/components/GroupList.test.js | 3 +-- src/group/membership/components/GroupMembers.test.js | 3 +-- .../components/LandscapeForm/AffiliationUpdate.test.js | 3 +-- .../LandscapeForm/BoundaryStepNewBoundariesFile.test.js | 3 +-- .../LandscapeForm/BoundaryStepNewDrawPolygon.test.js | 3 +-- .../components/LandscapeForm/BoundaryStepNewFormPin.test.js | 3 +-- .../components/LandscapeForm/DevelopmentStrategyUpdate.test.js | 3 +-- src/landscape/components/LandscapeForm/KeyInfoNew.test.js | 3 +-- src/landscape/components/LandscapeForm/KeyInfoUpdate.test.js | 3 +-- .../components/LandscapeForm/ProfileImageUpdate.test.js | 3 +-- src/landscape/components/LandscapeForm/ProfileUpdate.test.js | 3 +-- src/landscape/components/LandscapeList.test.js | 3 +-- src/landscape/membership/components/LandscapeMembers.test.js | 3 +-- src/layout/AppBar.test.js | 3 +-- src/localization/components/LocalePicker.test.js | 3 +-- src/navigation/components/Navigation.test.js | 3 +-- src/tests/utils.js | 2 +- 20 files changed, 20 insertions(+), 39 deletions(-) diff --git a/src/account/components/AccountProfile.test.js b/src/account/components/AccountProfile.test.js index f6d97758c0..2108b69033 100644 --- a/src/account/components/AccountProfile.test.js +++ b/src/account/components/AccountProfile.test.js @@ -15,10 +15,9 @@ * along with this program. If not, see https://www.gnu.org/licenses/. */ import { fireEvent, render, screen, within } from 'tests/utils'; -import React from 'react'; +import React, { act } from 'react'; import { when } from 'jest-when'; import _ from 'lodash/fp'; -import { act } from 'react'; import { useNavigate, useParams, useSearchParams } from 'react-router-dom'; import * as terrasoApi from 'terraso-client-shared/terrasoApi/api'; diff --git a/src/contact/ContactForm.test.js b/src/contact/ContactForm.test.js index fde6dc3c36..6fc984f2c3 100644 --- a/src/contact/ContactForm.test.js +++ b/src/contact/ContactForm.test.js @@ -15,9 +15,8 @@ * along with this program. If not, see https://www.gnu.org/licenses/. */ import { render, screen } from 'tests/utils'; -import React from 'react'; +import React, { act } from 'react'; import _ from 'lodash/fp'; -import { act } from 'react'; import { useScript } from 'custom-hooks'; diff --git a/src/group/components/GroupForm.test.js b/src/group/components/GroupForm.test.js index 1d6511d6e8..eb3c215248 100644 --- a/src/group/components/GroupForm.test.js +++ b/src/group/components/GroupForm.test.js @@ -15,8 +15,7 @@ * along with this program. If not, see https://www.gnu.org/licenses/. */ import { fireEvent, render, screen, within } from 'tests/utils'; -import React from 'react'; -import { act } from 'react'; +import React, { act } from 'react'; import { useNavigate, useParams } from 'react-router-dom'; import * as terrasoApi from 'terraso-client-shared/terrasoApi/api'; diff --git a/src/group/components/GroupList.test.js b/src/group/components/GroupList.test.js index 32114687af..8d01c12aa8 100644 --- a/src/group/components/GroupList.test.js +++ b/src/group/components/GroupList.test.js @@ -15,8 +15,7 @@ * along with this program. If not, see https://www.gnu.org/licenses/. */ import { fireEvent, render, screen, within } from 'tests/utils'; -import React from 'react'; -import { act } from 'react'; +import React, { act } from 'react'; import { useSearchParams } from 'react-router-dom'; import * as terrasoApi from 'terraso-client-shared/terrasoApi/api'; import useMediaQuery from '@mui/material/useMediaQuery'; diff --git a/src/group/membership/components/GroupMembers.test.js b/src/group/membership/components/GroupMembers.test.js index 6a773bdd27..dd2d039918 100644 --- a/src/group/membership/components/GroupMembers.test.js +++ b/src/group/membership/components/GroupMembers.test.js @@ -15,9 +15,8 @@ * along with this program. If not, see https://www.gnu.org/licenses/. */ import { fireEvent, render, screen, waitFor, within } from 'tests/utils'; -import React from 'react'; +import React, { act } from 'react'; import _ from 'lodash/fp'; -import { act } from 'react'; import { useNavigate, useParams } from 'react-router-dom'; import * as terrasoApi from 'terraso-client-shared/terrasoApi/api'; import { GROUP_TYPES_WITH_REDIRECTS } from 'tests/constants'; diff --git a/src/landscape/components/LandscapeForm/AffiliationUpdate.test.js b/src/landscape/components/LandscapeForm/AffiliationUpdate.test.js index 0c3d26b896..0544f705e9 100644 --- a/src/landscape/components/LandscapeForm/AffiliationUpdate.test.js +++ b/src/landscape/components/LandscapeForm/AffiliationUpdate.test.js @@ -15,8 +15,7 @@ * along with this program. If not, see https://www.gnu.org/licenses/. */ import { fireEvent, render, screen, within } from 'tests/utils'; -import React from 'react'; -import { act } from 'react'; +import React, { act } from 'react'; import { useParams } from 'react-router-dom'; import * as terrasoApi from 'terraso-client-shared/terrasoApi/api'; diff --git a/src/landscape/components/LandscapeForm/BoundaryStepNewBoundariesFile.test.js b/src/landscape/components/LandscapeForm/BoundaryStepNewBoundariesFile.test.js index 0d825174b5..2a215679b9 100644 --- a/src/landscape/components/LandscapeForm/BoundaryStepNewBoundariesFile.test.js +++ b/src/landscape/components/LandscapeForm/BoundaryStepNewBoundariesFile.test.js @@ -15,8 +15,7 @@ * along with this program. If not, see https://www.gnu.org/licenses/. */ import { fireEvent, render, screen, waitFor, within } from 'tests/utils'; -import React from 'react'; -import { act } from 'react'; +import React, { act } from 'react'; import { useParams } from 'react-router-dom'; import * as terrasoApi from 'terraso-client-shared/terrasoApi/api'; diff --git a/src/landscape/components/LandscapeForm/BoundaryStepNewDrawPolygon.test.js b/src/landscape/components/LandscapeForm/BoundaryStepNewDrawPolygon.test.js index b1fcc54e89..e511abb795 100644 --- a/src/landscape/components/LandscapeForm/BoundaryStepNewDrawPolygon.test.js +++ b/src/landscape/components/LandscapeForm/BoundaryStepNewDrawPolygon.test.js @@ -15,9 +15,8 @@ * along with this program. If not, see https://www.gnu.org/licenses/. */ import { fireEvent, render, screen, waitFor, within } from 'tests/utils'; -import React from 'react'; +import React, { act } from 'react'; import MapboxDraw from '@mapbox/mapbox-gl-draw'; -import { act } from 'react'; import { useParams } from 'react-router-dom'; import * as terrasoApi from 'terraso-client-shared/terrasoApi/api'; diff --git a/src/landscape/components/LandscapeForm/BoundaryStepNewFormPin.test.js b/src/landscape/components/LandscapeForm/BoundaryStepNewFormPin.test.js index 362a1e9763..1508d3b8f5 100644 --- a/src/landscape/components/LandscapeForm/BoundaryStepNewFormPin.test.js +++ b/src/landscape/components/LandscapeForm/BoundaryStepNewFormPin.test.js @@ -15,9 +15,8 @@ * along with this program. If not, see https://www.gnu.org/licenses/. */ import { fireEvent, render, screen, waitFor, within } from 'tests/utils'; -import React from 'react'; +import React, { act } from 'react'; import MapboxDraw from '@mapbox/mapbox-gl-draw'; -import { act } from 'react'; import { useParams } from 'react-router-dom'; import * as terrasoApi from 'terraso-client-shared/terrasoApi/api'; diff --git a/src/landscape/components/LandscapeForm/DevelopmentStrategyUpdate.test.js b/src/landscape/components/LandscapeForm/DevelopmentStrategyUpdate.test.js index accdb24749..a9d0ecb2b1 100644 --- a/src/landscape/components/LandscapeForm/DevelopmentStrategyUpdate.test.js +++ b/src/landscape/components/LandscapeForm/DevelopmentStrategyUpdate.test.js @@ -15,8 +15,7 @@ * along with this program. If not, see https://www.gnu.org/licenses/. */ import { fireEvent, render, screen } from 'tests/utils'; -import React from 'react'; -import { act } from 'react'; +import React, { act } from 'react'; import { useParams } from 'react-router-dom'; import * as terrasoApi from 'terraso-client-shared/terrasoApi/api'; diff --git a/src/landscape/components/LandscapeForm/KeyInfoNew.test.js b/src/landscape/components/LandscapeForm/KeyInfoNew.test.js index aa6dfefac7..65b95e077e 100644 --- a/src/landscape/components/LandscapeForm/KeyInfoNew.test.js +++ b/src/landscape/components/LandscapeForm/KeyInfoNew.test.js @@ -15,8 +15,7 @@ * along with this program. If not, see https://www.gnu.org/licenses/. */ import { fireEvent, render, screen, waitFor, within } from 'tests/utils'; -import React from 'react'; -import { act } from 'react'; +import React, { act } from 'react'; import { useParams } from 'react-router-dom'; import * as terrasoApi from 'terraso-client-shared/terrasoApi/api'; diff --git a/src/landscape/components/LandscapeForm/KeyInfoUpdate.test.js b/src/landscape/components/LandscapeForm/KeyInfoUpdate.test.js index 912b216bb5..3199eb095f 100644 --- a/src/landscape/components/LandscapeForm/KeyInfoUpdate.test.js +++ b/src/landscape/components/LandscapeForm/KeyInfoUpdate.test.js @@ -15,8 +15,7 @@ * along with this program. If not, see https://www.gnu.org/licenses/. */ import { fireEvent, render, screen, within } from 'tests/utils'; -import React from 'react'; -import { act } from 'react'; +import React, { act } from 'react'; import { useParams } from 'react-router-dom'; import * as terrasoApi from 'terraso-client-shared/terrasoApi/api'; diff --git a/src/landscape/components/LandscapeForm/ProfileImageUpdate.test.js b/src/landscape/components/LandscapeForm/ProfileImageUpdate.test.js index eb5a9b7f8a..75b5aa7ef2 100644 --- a/src/landscape/components/LandscapeForm/ProfileImageUpdate.test.js +++ b/src/landscape/components/LandscapeForm/ProfileImageUpdate.test.js @@ -15,9 +15,8 @@ * along with this program. If not, see https://www.gnu.org/licenses/. */ import { fireEvent, render, screen, waitFor } from 'tests/utils'; -import React from 'react'; +import React, { act } from 'react'; import AvatarEditor from 'react-avatar-editor'; -import { act } from 'react'; import { useParams } from 'react-router-dom'; import * as terrasoApi from 'terraso-client-shared/terrasoApi/api'; diff --git a/src/landscape/components/LandscapeForm/ProfileUpdate.test.js b/src/landscape/components/LandscapeForm/ProfileUpdate.test.js index 93d2e0651a..72dcaf7ea7 100644 --- a/src/landscape/components/LandscapeForm/ProfileUpdate.test.js +++ b/src/landscape/components/LandscapeForm/ProfileUpdate.test.js @@ -15,8 +15,7 @@ * along with this program. If not, see https://www.gnu.org/licenses/. */ import { fireEvent, render, screen, within } from 'tests/utils'; -import React from 'react'; -import { act } from 'react'; +import React, { act } from 'react'; import { useParams } from 'react-router-dom'; import * as terrasoApi from 'terraso-client-shared/terrasoApi/api'; diff --git a/src/landscape/components/LandscapeList.test.js b/src/landscape/components/LandscapeList.test.js index 46551f9c86..a7b49c0e79 100644 --- a/src/landscape/components/LandscapeList.test.js +++ b/src/landscape/components/LandscapeList.test.js @@ -15,8 +15,7 @@ * along with this program. If not, see https://www.gnu.org/licenses/. */ import { fireEvent, render, screen, waitFor, within } from 'tests/utils'; -import React from 'react'; -import { act } from 'react'; +import React, { act } from 'react'; import { useSearchParams } from 'react-router-dom'; import * as terrasoApi from 'terraso-client-shared/terrasoApi/api'; import { mockTerrasoAPIrequestGraphQL } from 'tests/apiUtils'; diff --git a/src/landscape/membership/components/LandscapeMembers.test.js b/src/landscape/membership/components/LandscapeMembers.test.js index 5a864cc0e0..b7dc1b7853 100644 --- a/src/landscape/membership/components/LandscapeMembers.test.js +++ b/src/landscape/membership/components/LandscapeMembers.test.js @@ -15,9 +15,8 @@ * along with this program. If not, see https://www.gnu.org/licenses/. */ import { fireEvent, render, screen, waitFor, within } from 'tests/utils'; -import React from 'react'; +import React, { act } from 'react'; import _ from 'lodash/fp'; -import { act } from 'react'; import * as terrasoApi from 'terraso-client-shared/terrasoApi/api'; import { mockTerrasoAPIrequestGraphQL } from 'tests/apiUtils'; import useMediaQuery from '@mui/material/useMediaQuery'; diff --git a/src/layout/AppBar.test.js b/src/layout/AppBar.test.js index 0cbe4e18ca..ea3f0f0d4c 100644 --- a/src/layout/AppBar.test.js +++ b/src/layout/AppBar.test.js @@ -15,9 +15,8 @@ * along with this program. If not, see https://www.gnu.org/licenses/. */ import { fireEvent, render, screen } from 'tests/utils'; -import React from 'react'; +import React, { act } from 'react'; import Cookies from 'js-cookie'; -import { act } from 'react'; import { useLocation, useNavigate } from 'react-router-dom'; import useMediaQuery from '@mui/material/useMediaQuery'; diff --git a/src/localization/components/LocalePicker.test.js b/src/localization/components/LocalePicker.test.js index fce6b7bd7b..0e4b58262a 100644 --- a/src/localization/components/LocalePicker.test.js +++ b/src/localization/components/LocalePicker.test.js @@ -15,9 +15,8 @@ * along with this program. If not, see https://www.gnu.org/licenses/. */ import { fireEvent, render, screen, within } from 'tests/utils'; -import React from 'react'; +import React, { act } from 'react'; import _ from 'lodash/fp'; -import { act } from 'react'; import * as terrasoApi from 'terraso-client-shared/terrasoApi/api'; import useMediaQuery from '@mui/material/useMediaQuery'; diff --git a/src/navigation/components/Navigation.test.js b/src/navigation/components/Navigation.test.js index 2151f656b8..07b76229eb 100644 --- a/src/navigation/components/Navigation.test.js +++ b/src/navigation/components/Navigation.test.js @@ -15,8 +15,7 @@ * along with this program. If not, see https://www.gnu.org/licenses/. */ import { fireEvent, render, screen } from 'tests/utils'; -import React from 'react'; -import { act } from 'react'; +import React, { act } from 'react'; import { useLocation } from 'react-router-dom'; import Navigation from 'navigation/components/Navigation'; diff --git a/src/tests/utils.js b/src/tests/utils.js index e1c3867d78..0088735b7f 100644 --- a/src/tests/utils.js +++ b/src/tests/utils.js @@ -19,13 +19,13 @@ import React from 'react'; // import for side effects to ensure config happens before running tests import 'config'; +import { act } from 'react'; import { waitFor as baseWaitFor, cleanup, render as rtlRender, } from '@testing-library/react'; import { axe, toHaveNoViolations } from 'jest-axe'; -import { act } from 'react'; import createStore from 'terrasoApi/store'; import AppWrappers from 'layout/AppWrappers';