From 4793eba46869cc54c6cdc9dd6737d739476ba69a Mon Sep 17 00:00:00 2001 From: Abhishek-17H Date: Tue, 21 Jan 2025 11:49:50 +0530 Subject: [PATCH] Migrated src/components/theme to vitest --- .../__snapshots__/Anontools.test.jsx.snap | 6 +- .../src/components/theme/App/App.test.jsx | 40 ++++--- .../theme/App/__snapshots__/App.test.jsx.snap | 10 +- .../theme/AppExtras/AppExtras.test.jsx | 14 ++- .../__snapshots__/AppExtras.test.jsx.snap | 26 ++--- .../Avatar/__snapshots__/Avatar.test.jsx.snap | 2 +- .../__snapshots__/Breadcrumbs.test.jsx.snap | 10 +- .../theme/Comments/CommentEditModal.test.jsx | 2 +- .../theme/Comments/Comments.test.jsx | 23 ++-- .../CommentEditModal.test.jsx.snap | 30 ++--- .../__snapshots__/Comments.test.jsx.snap | 30 ++--- .../__snapshots__/Component.test.jsx.snap | 10 +- .../ConnectionRefused.test.jsx.snap | 10 +- .../theme/ContactForm/ContactForm.test.jsx | 8 +- .../__snapshots__/ContactForm.test.jsx.snap | 106 +++++++++--------- .../__snapshots__/CorsError.test.jsx.snap | 10 +- .../Error/__snapshots__/Error.test.jsx.snap | 4 +- .../__snapshots__/ErrorBoundary.test.jsx.snap | 4 +- .../__snapshots__/EventDetails.test.jsx.snap | 20 ++-- .../__snapshots__/Forbidden.test.jsx.snap | 4 +- .../components/theme/Header/Header.test.jsx | 32 +++--- .../Header/__snapshots__/Header.test.jsx.snap | 6 +- .../Icon/__snapshots__/Icon.test.jsx.snap | 6 +- .../Image/__snapshots__/Image.test.jsx.snap | 2 +- .../LanguageSelector.test.jsx.snap | 4 +- .../Login/__snapshots__/Login.test.jsx.snap | 16 +-- .../Logo.Multilingual.test.jsx.snap | 14 +-- .../Logo/__snapshots__/Logo.test.jsx.snap | 12 +- .../components/theme/Logout/Logout.test.jsx | 2 +- .../Logout/__snapshots__/Logout.test.jsx.snap | 4 +- .../MultilingualRedirector.test.jsx.snap | 4 +- .../ContextNavigation.test.jsx.snap | 14 +-- .../Navigation.Multilingual.test.jsx.snap | 16 +-- .../__snapshots__/Navigation.test.jsx.snap | 18 +-- .../__snapshots__/NotFound.test.jsx.snap | 4 +- .../__snapshots__/Pagination.test.jsx.snap | 32 ++---- .../RequestPasswordReset.test.jsx | 2 +- .../__snapshots__/PasswordReset.test.jsx.snap | 4 +- .../RequestPasswordReset.test.jsx.snap | 28 ++--- .../__snapshots__/PreviewImage.test.jsx.snap | 50 ++++----- .../theme/Register/Register.test.jsx | 2 +- .../__snapshots__/Register.test.jsx.snap | 40 +++---- .../__snapshots__/RelatedItems.test.jsx.snap | 8 +- .../RequestTimeout.test.jsx.snap | 10 +- .../components/theme/Search/Search.test.jsx | 10 +- .../Search/__snapshots__/Search.test.jsx.snap | 6 +- .../__snapshots__/SearchTags.test.jsx.snap | 4 +- .../__snapshots__/SearchWidget.test.jsx.snap | 10 +- .../__snapshots__/Sitemap.test.jsx.snap | 22 ++-- .../__snapshots__/SkipLinks.test.jsx.snap | 4 +- .../Tags/__snapshots__/Tags.test.jsx.snap | 6 +- .../Title/__snapshots__/Title.test.jsx.snap | 2 +- .../components/theme/TsTest/TsTest.test.tsx | 1 - .../TsTest/__snapshots__/TsTest.test.tsx.snap | 4 +- .../__snapshots__/Unauthorized.test.jsx.snap | 4 +- .../theme/View/EventDatesInfo.test.jsx | 11 +- .../components/theme/View/EventView.test.jsx | 10 +- .../src/components/theme/View/View.test.jsx | 29 +++-- .../__snapshots__/AlbumView.test.jsx.snap | 2 +- .../__snapshots__/DefaultView.test.jsx.snap | 2 +- .../EventDatesInfo.test.jsx.snap | 2 +- .../__snapshots__/EventView.test.jsx.snap | 32 +++--- .../View/__snapshots__/FileView.test.jsx.snap | 2 +- .../__snapshots__/ImageView.test.jsx.snap | 10 +- .../View/__snapshots__/LinkView.test.jsx.snap | 2 +- .../__snapshots__/ListingView.test.jsx.snap | 4 +- .../__snapshots__/NewsItemView.test.jsx.snap | 8 +- .../__snapshots__/RenderBlocks.test.jsx.snap | 2 +- .../__snapshots__/SummaryView.test.jsx.snap | 4 +- .../__snapshots__/TabularView.test.jsx.snap | 4 +- .../View/__snapshots__/View.test.jsx.snap | 10 +- .../__snapshots__/ArrayWidget.test.jsx.snap | 12 +- .../__snapshots__/BooleanWidget.test.jsx.snap | 12 +- .../__snapshots__/DateWidget.test.jsx.snap | 10 +- .../DatetimeWidget.test.jsx.snap | 10 +- .../DescriptionWidget.test.jsx.snap | 8 +- .../__snapshots__/EmailWidget.test.jsx.snap | 8 +- .../__snapshots__/FileWidget.test.jsx.snap | 10 +- .../__snapshots__/ImageWidget.test.jsx.snap | 8 +- .../PasswordWidget.test.jsx.snap | 8 +- .../RelationWidget.test.jsx.snap | 28 ++--- .../RelationsWidget.test.jsx.snap | 60 ++++------ .../RichTextWidget.test.jsx.snap | 12 +- .../__snapshots__/SelectWidget.test.jsx.snap | 10 +- .../__snapshots__/TextWidget.test.jsx.snap | 12 +- .../__snapshots__/TitleWidget.test.jsx.snap | 8 +- .../__snapshots__/TokenWidget.test.jsx.snap | 8 +- .../__snapshots__/UrlWidget.test.jsx.snap | 8 +- 88 files changed, 552 insertions(+), 586 deletions(-) diff --git a/packages/volto/src/components/theme/Anontools/__snapshots__/Anontools.test.jsx.snap b/packages/volto/src/components/theme/Anontools/__snapshots__/Anontools.test.jsx.snap index 70b76d32f0..3254ebdaf1 100644 --- a/packages/volto/src/components/theme/Anontools/__snapshots__/Anontools.test.jsx.snap +++ b/packages/volto/src/components/theme/Anontools/__snapshots__/Anontools.test.jsx.snap @@ -1,6 +1,6 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`Anontools renders an anontools component when no token is specified 1`] = ` +exports[`Anontools > renders an anontools component when no token is specified 1`] = `
@@ -19,4 +19,4 @@ exports[`Anontools renders an anontools component when no token is specified 1`]
`; -exports[`Anontools should not render an anontools component when a token is specified 1`] = `null`; +exports[`Anontools > should not render an anontools component when a token is specified 1`] = `null`; diff --git a/packages/volto/src/components/theme/App/App.test.jsx b/packages/volto/src/components/theme/App/App.test.jsx index e9284aac39..130d397a91 100644 --- a/packages/volto/src/components/theme/App/App.test.jsx +++ b/packages/volto/src/components/theme/App/App.test.jsx @@ -7,6 +7,8 @@ import configureStore from 'redux-mock-store'; import { __test__ as App } from './App'; +import { vi } from 'vitest'; + beforeAll(() => { config.settings.navDepth = 1; config.views.errorViews = { @@ -16,24 +18,28 @@ beforeAll(() => { const mockStore = configureStore(); -jest.mock('../../manage/Toolbar/Toolbar', () => - jest.fn(() =>
), -); -jest.mock('../Header/Header', () => jest.fn(() =>
)); -jest.mock('../Breadcrumbs/Breadcrumbs', () => - jest.fn(() =>