From 0ff16c08eafafa36d968f383e83bbfdd0fc82989 Mon Sep 17 00:00:00 2001 From: literat Date: Tue, 17 Dec 2024 17:57:09 +0100 Subject: [PATCH] fixup! Test(web-react): Use Jest's automock functionality to share useIcon mock between tests --- .../components/ButtonLink/__tests__/ButtonLink.test.tsx | 1 - .../FileUploader/__tests__/FileUploaderList.test.tsx | 1 - .../Pagination/__tests__/UncontrolledPagination.test.tsx | 1 - .../src/components/Select/__tests__/Select.test.tsx | 1 - .../src/components/Spinner/__tests__/Spinner.test.tsx | 8 +------- .../components/Toast/__tests__/UncontrolledToast.test.tsx | 1 - .../UNSTABLE_Avatar/__tests__/UNSTABLE_Avatar.test.tsx | 8 +------- 7 files changed, 2 insertions(+), 19 deletions(-) diff --git a/packages/web-react/src/components/ButtonLink/__tests__/ButtonLink.test.tsx b/packages/web-react/src/components/ButtonLink/__tests__/ButtonLink.test.tsx index c9851f4bb9..11a804fc7d 100644 --- a/packages/web-react/src/components/ButtonLink/__tests__/ButtonLink.test.tsx +++ b/packages/web-react/src/components/ButtonLink/__tests__/ButtonLink.test.tsx @@ -2,7 +2,6 @@ import '@testing-library/jest-dom'; import { render, screen } from '@testing-library/react'; import React from 'react'; import { - useIconMock, classNamePrefixProviderTest, actionButtonColorPropsTest, emotionColorPropsTest, diff --git a/packages/web-react/src/components/FileUploader/__tests__/FileUploaderList.test.tsx b/packages/web-react/src/components/FileUploader/__tests__/FileUploaderList.test.tsx index c7f3766d65..7a4123e95d 100644 --- a/packages/web-react/src/components/FileUploader/__tests__/FileUploaderList.test.tsx +++ b/packages/web-react/src/components/FileUploader/__tests__/FileUploaderList.test.tsx @@ -1,6 +1,5 @@ import { render } from '@testing-library/react'; import React from 'react'; -import { useIconMock } from '@local/tests'; import { SpiritFileUploaderAttachmentProps } from '../../../types'; import FileUploader from '../FileUploader'; import FileUploaderList from '../FileUploaderList'; diff --git a/packages/web-react/src/components/Pagination/__tests__/UncontrolledPagination.test.tsx b/packages/web-react/src/components/Pagination/__tests__/UncontrolledPagination.test.tsx index 437d432acd..b29a3bd6f1 100644 --- a/packages/web-react/src/components/Pagination/__tests__/UncontrolledPagination.test.tsx +++ b/packages/web-react/src/components/Pagination/__tests__/UncontrolledPagination.test.tsx @@ -1,6 +1,5 @@ import { fireEvent, render, screen } from '@testing-library/react'; import React from 'react'; -import { useIconMock } from '@local/tests'; import UncontrolledPagination from '../UncontrolledPagination'; jest.mock('../../../hooks/useIcon'); diff --git a/packages/web-react/src/components/Select/__tests__/Select.test.tsx b/packages/web-react/src/components/Select/__tests__/Select.test.tsx index 62b210b83d..6e530e125d 100644 --- a/packages/web-react/src/components/Select/__tests__/Select.test.tsx +++ b/packages/web-react/src/components/Select/__tests__/Select.test.tsx @@ -2,7 +2,6 @@ import '@testing-library/jest-dom'; import { render } from '@testing-library/react'; import React from 'react'; import { - useIconMock, classNamePrefixProviderTest, validationStatePropsTest, requiredPropsTest, diff --git a/packages/web-react/src/components/Spinner/__tests__/Spinner.test.tsx b/packages/web-react/src/components/Spinner/__tests__/Spinner.test.tsx index e5cc03d907..d17ac3f2e3 100644 --- a/packages/web-react/src/components/Spinner/__tests__/Spinner.test.tsx +++ b/packages/web-react/src/components/Spinner/__tests__/Spinner.test.tsx @@ -1,13 +1,7 @@ import '@testing-library/jest-dom'; import { render } from '@testing-library/react'; import React from 'react'; -import { - useIconMock, - classNamePrefixProviderTest, - textColorPropsTest, - restPropsTest, - stylePropsTest, -} from '@local/tests'; +import { classNamePrefixProviderTest, textColorPropsTest, restPropsTest, stylePropsTest } from '@local/tests'; import Spinner from '../Spinner'; jest.mock('../../../hooks/useIcon'); diff --git a/packages/web-react/src/components/Toast/__tests__/UncontrolledToast.test.tsx b/packages/web-react/src/components/Toast/__tests__/UncontrolledToast.test.tsx index 55d227c993..69042650f1 100644 --- a/packages/web-react/src/components/Toast/__tests__/UncontrolledToast.test.tsx +++ b/packages/web-react/src/components/Toast/__tests__/UncontrolledToast.test.tsx @@ -1,7 +1,6 @@ import '@testing-library/jest-dom'; import { render } from '@testing-library/react'; import React from 'react'; -import { useIconMock } from '@local/tests'; import { ToastLinkProps } from '../../../types'; import { ToastContext } from '../ToastContext'; import UncontrolledToast from '../UncontrolledToast'; diff --git a/packages/web-react/src/components/UNSTABLE_Avatar/__tests__/UNSTABLE_Avatar.test.tsx b/packages/web-react/src/components/UNSTABLE_Avatar/__tests__/UNSTABLE_Avatar.test.tsx index fe6ee0ac80..68b1210fb7 100644 --- a/packages/web-react/src/components/UNSTABLE_Avatar/__tests__/UNSTABLE_Avatar.test.tsx +++ b/packages/web-react/src/components/UNSTABLE_Avatar/__tests__/UNSTABLE_Avatar.test.tsx @@ -1,13 +1,7 @@ import '@testing-library/jest-dom'; import { render, screen } from '@testing-library/react'; import React from 'react'; -import { - useIconMock, - classNamePrefixProviderTest, - sizeExtendedPropsTest, - restPropsTest, - stylePropsTest, -} from '@local/tests'; +import { classNamePrefixProviderTest, sizeExtendedPropsTest, restPropsTest, stylePropsTest } from '@local/tests'; import { Icon } from '../../Icon'; import UNSTABLE_Avatar from '../UNSTABLE_Avatar';