From 25003e05d0a932fdf368349daaf45f968b02b7fd Mon Sep 17 00:00:00 2001 From: Abhishek-17H Date: Tue, 21 Jan 2025 13:55:39 +0530 Subject: [PATCH] Migrated src/components/manage to vitest and other files --- packages/volto/.editorconfig | 1 + packages/volto/.eslintignore | 3 + packages/volto/.eslintrc | 2 + packages/volto/.i18nrc.js | 10 + .../__tests__/addon-registry-project.test.js | 20 +- .../__tests__/addon-registry-volto.test.js | 1 + .../__tests__/create-addons-loader.test.js | 1 + .../__tests__/volto-slate/deserialize.test.js | 2 +- .../webpack-relative-resolver.test.js | 1 + packages/volto/package.json | 4 +- .../manage/Actions/Actions.test.jsx | 2 +- .../__snapshots__/Actions.test.jsx.snap | 4 +- .../src/components/manage/Add/Add.test.jsx | 11 +- .../Add/__snapshots__/Add.test.jsx.snap | 8 +- .../manage/Aliases/Aliases.test.jsx | 10 +- .../__snapshots__/Aliases.test.jsx.snap | 4 +- .../__snapshots__/BlockChooser.test.jsx.snap | 22 +- .../BlockChooserButton.test.jsx.snap | 4 +- .../BlockChooserSearch.test.jsx.snap | 4 +- .../manage/Blocks/Block/BlocksForm.test.jsx | 59 +- .../manage/Blocks/Block/Settings.test.jsx | 2 +- .../__snapshots__/BlocksForm.test.jsx.snap | 313 ++----- .../__snapshots__/Settings.test.jsx.snap | 16 +- .../Block/__snapshots__/Style.test.jsx.snap | 2 +- .../manage/Blocks/Description/View.test.jsx | 2 +- .../__snapshots__/Edit.test.jsx.snap | 6 +- .../__snapshots__/View.test.jsx.snap | 2 +- .../manage/Blocks/HTML/Edit.test.jsx | 10 +- .../manage/Blocks/HTML/View.test.jsx | 2 +- .../HTML/__snapshots__/Edit.test.jsx.snap | 2 +- .../HTML/__snapshots__/View.test.jsx.snap | 4 +- .../manage/Blocks/Image/ImageSidebar.test.jsx | 4 +- .../Image/__snapshots__/Edit.test.jsx.snap | 2 +- .../__snapshots__/ImageSidebar.test.jsx.snap | 84 +- .../LeadImage/LeadImageSidebar.test.jsx | 4 +- .../__snapshots__/Edit.test.jsx.snap | 10 +- .../LeadImageSidebar.test.jsx.snap | 32 +- .../__snapshots__/View.test.jsx.snap | 10 +- .../manage/Blocks/Listing/View.test.jsx | 4 +- .../__snapshots__/ListingBody.test.jsx.snap | 2 +- .../__snapshots__/ListingData.test.jsx.snap | 56 +- .../Listing/__snapshots__/View.test.jsx.snap | 2 +- .../manage/Blocks/Maps/MapsSidebar.test.jsx | 2 +- .../Maps/__snapshots__/Edit.test.jsx.snap | 2 +- .../__snapshots__/MapsSidebar.test.jsx.snap | 40 +- .../Maps/__snapshots__/View.test.jsx.snap | 2 +- .../Search/components/DateRangeFacet.test.jsx | 13 +- .../Search/components/SelectFacet.test.jsx | 11 +- .../__snapshots__/CheckboxFacet.test.jsx.snap | 4 +- .../DateRangeFacet.test.jsx.snap | 6 +- .../__snapshots__/FilterList.test.jsx.snap | 10 +- .../__snapshots__/SearchDetails.test.jsx.snap | 4 +- .../__snapshots__/SearchInput.test.jsx.snap | 10 +- .../__snapshots__/SelectFacet.test.jsx.snap | 6 +- .../Title/__snapshots__/Edit.test.jsx.snap | 6 +- .../Title/__snapshots__/View.test.jsx.snap | 2 +- .../DefaultTocRenderer.test.jsx.snap | 2 +- .../manage/Blocks/Video/VideoSidebar.test.jsx | 2 +- .../Video/__snapshots__/Body.test.jsx.snap | 2 +- .../Video/__snapshots__/Edit.test.jsx.snap | 2 +- .../__snapshots__/VideoSidebar.test.jsx.snap | 42 +- .../Video/__snapshots__/View.test.jsx.snap | 2 +- .../ConditionalLink.test.jsx.snap | 6 +- .../manage/Contents/Contents.test.jsx | 26 +- .../Contents/ContentsPropertiesModal.test.jsx | 2 +- .../Contents/ContentsRenameModal.test.jsx | 2 +- .../Contents/ContentsTagsModal.test.jsx | 2 +- .../Contents/ContentsWorkflowModal.test.jsx | 2 +- .../manage/Contents/__mocks__/index.tsx | 5 +- .../__snapshots__/Contents.test.jsx.snap | 70 +- ...entsBreadcrumbs.Multilingual.test.jsx.snap | 6 +- .../ContentsBreadcrumbs.test.jsx.snap | 6 +- .../ContentsIndexHeader.test.jsx.snap | 4 +- .../__snapshots__/ContentsItem.test.jsx.snap | 30 +- .../ContentsPropertiesModal.test.jsx.snap | 72 +- .../ContentsRenameModal.test.jsx.snap | 36 +- .../ContentsTagsModal.test.jsx.snap | 44 +- .../ContentsUploadModal.test.jsx.snap | 10 +- .../ContentsWorkflowModal.test.jsx.snap | 6 +- .../Controlpanels/AddonsControlpanel.test.jsx | 31 +- .../manage/Controlpanels/Aliases.test.jsx | 27 +- .../manage/Controlpanels/ContentType.test.jsx | 28 +- .../Controlpanels/ContentTypeLayout.test.jsx | 6 +- .../Controlpanels/ContentTypes.test.jsx | 27 +- .../Controlpanels/Controlpanel.test.jsx | 43 +- .../Controlpanels/Controlpanels.test.jsx | 50 +- .../Groups/GroupsControlpanel.test.jsx | 4 +- .../GroupsControlpanel.test.jsx.snap | 6 +- .../__snapshots__/RenderGroups.test.jsx.snap | 12 +- .../Controlpanels/ModerateComments.test.jsx | 36 +- .../Controlpanels/Rules/AddRule.test.jsx | 6 +- .../Rules/ConfigureRule.test.jsx | 4 +- .../Controlpanels/Rules/EditRule.test.jsx | 6 +- .../manage/Controlpanels/Rules/Rules.test.jsx | 4 +- .../Rules/__snapshots__/AddRule.test.jsx.snap | 4 +- .../__snapshots__/ConfigureRule.test.jsx.snap | 4 +- .../__snapshots__/EditRule.test.jsx.snap | 4 +- .../Rules/__snapshots__/Rules.test.jsx.snap | 4 +- .../Controlpanels/UndoControlpanel.test.jsx | 33 +- .../UserGroupMembershipControlPanel.test.jsx | 4 +- .../Users/UsersControlpanel.test.jsx | 4 +- .../__snapshots__/RenderUsers.test.jsx.snap | 18 +- ...rGroupMembershipControlPanel.test.jsx.snap | 4 +- .../UsersControlpanel.test.jsx.snap | 6 +- .../AddonsControlpanel.test.jsx.snap | 274 +++--- .../__snapshots__/Aliases.test.jsx.snap | 16 +- .../__snapshots__/ContentType.test.jsx.snap | 10 +- .../ContentTypeLayout.test.jsx.snap | 4 +- .../__snapshots__/ContentTypes.test.jsx.snap | 26 +- .../__snapshots__/Controlpanel.test.jsx.snap | 20 +- .../__snapshots__/Controlpanels.test.jsx.snap | 70 +- .../ModerateComments.test.jsx.snap | 110 ++- .../UndoControlpanel.test.jsx.snap | 806 +++++++++--------- .../components/manage/Delete/Delete.test.jsx | 49 +- .../Delete/__snapshots__/Delete.test.jsx.snap | 12 +- .../src/components/manage/Diff/Diff.test.jsx | 16 +- .../components/manage/Diff/DiffField.test.jsx | 11 +- .../Diff/__snapshots__/Diff.test.jsx.snap | 4 +- .../__snapshots__/DiffField.test.jsx.snap | 20 +- .../manage/Display/Display.test.jsx | 12 +- .../__snapshots__/Display.test.jsx.snap | 6 +- .../src/components/manage/Edit/Edit.test.jsx | 10 +- .../Edit/__snapshots__/Edit.test.jsx.snap | 8 +- .../manage/Form/BlockDataForm.test.jsx | 2 +- .../src/components/manage/Form/Form.test.jsx | 2 +- .../manage/Form/InlineForm.test.jsx | 2 +- .../components/manage/Form/ModalForm.test.jsx | 2 +- .../manage/Form/__mocks__/index.tsx | 20 +- .../__snapshots__/BlockDataForm.test.jsx.snap | 78 +- .../Form/__snapshots__/Field.test.jsx.snap | 30 +- .../Form/__snapshots__/Form.test.jsx.snap | 16 +- .../__snapshots__/InlineForm.test.jsx.snap | 10 +- .../__snapshots__/ModalForm.test.jsx.snap | 4 +- .../manage/History/History.test.jsx | 4 +- .../__snapshots__/History.test.jsx.snap | 8 +- .../manage/LinksToItem/LinksToItem.test.jsx | 10 +- .../__snapshots__/LinksToItem.test.jsx.snap | 4 +- .../__snapshots__/MaybeWrap.test.jsx.snap | 6 +- .../__snapshots__/Messages.test.jsx.snap | 4 +- .../Multilingual/ManageTranslations.test.jsx | 5 +- .../ManageTranslations.test.jsx.snap | 12 +- .../__snapshots__/Pluggable.test.jsx.snap | 10 +- .../Preferences/ChangePassword.test.jsx | 6 +- .../Preferences/PersonalInformation.test.jsx | 4 +- .../Preferences/PersonalPreferences.test.jsx | 16 +- .../ChangePassword.test.jsx.snap | 58 +- .../PersonalInformation.test.jsx.snap | 160 +--- .../PersonalPreferences.test.jsx.snap | 88 +- .../components/manage/Rules/Rules.test.jsx | 9 +- .../Rules/__snapshots__/Rules.test.jsx.snap | 4 +- .../manage/Sharing/Sharing.test.jsx | 4 +- .../__snapshots__/Sharing.test.jsx.snap | 8 +- .../ObjectBrowserNav.test.jsx.snap | 14 +- .../__snapshots__/Sidebar.test.jsx.snap | 22 +- .../__snapshots__/SidebarPopup.test.jsx.snap | 2 +- .../__snapshots__/SidebarPortal.test.jsx.snap | 2 +- .../TemplateChooser.test.jsx.snap | 4 +- .../__snapshots__/TextLineEdit.test.jsx.snap | 14 +- .../Toast/__snapshots__/Toast.test.jsx.snap | 10 +- .../components/manage/Toolbar/More.test.jsx | 13 +- .../Toolbar/__snapshots__/More.test.jsx.snap | 28 +- .../__snapshots__/PersonalTools.test.jsx.snap | 150 ++-- .../StandardWrapper.test.jsx.snap | 12 +- .../__snapshots__/Toolbar.test.jsx.snap | 90 +- .../Toolbar/__snapshots__/Types.test.jsx.snap | 10 +- .../UniversalLink/UniversalLink.test.jsx | 2 +- .../__snapshots__/UniversalLink.test.jsx.snap | 10 +- .../manage/Widgets/ArrayWidget.test.jsx | 21 +- .../manage/Widgets/DatetimeWidget.test.jsx | 16 +- .../manage/Widgets/FileWidget.test.jsx | 2 +- .../manage/Widgets/ObjectListWidget.test.jsx | 16 +- .../manage/Widgets/ObjectWidget.test.jsx | 2 +- .../RecurrenceWidget.test.jsx | 12 +- .../RecurrenceWidget.test.jsx.snap | 14 +- .../Widgets/RegistryImageWidget.test.jsx | 2 +- .../manage/Widgets/SchemaWidget.test.jsx | 10 +- .../Widgets/SchemaWidgetFieldset.test.jsx | 10 +- .../Widgets/SelectAutoComplete.test.jsx | 11 +- .../manage/Widgets/SelectWidget.test.jsx | 11 +- .../manage/Widgets/TokenWidget.test.jsx | 11 +- .../Widgets/VocabularyTermsWidget.test.jsx | 17 +- .../manage/Widgets/__mocks__/index.tsx | 70 +- .../__snapshots__/AlignWidget.test.jsx.snap | 16 +- .../__snapshots__/ArrayWidget.test.jsx.snap | 20 +- .../__snapshots__/ButtonsWidget.test.jsx.snap | 16 +- .../CheckboxWidget.test.jsx.snap | 6 +- .../ColorPickerWidget.test.jsx.snap | 6 +- .../DatetimeWidget.test.jsx.snap | 25 +- .../__snapshots__/EmailWidget.test.jsx.snap | 2 +- .../__snapshots__/FileWidget.test.jsx.snap | 40 +- .../__snapshots__/IdWidget.test.jsx.snap | 12 +- .../ImageSizeWidget.test.jsx.snap | 2 +- .../__snapshots__/NumberWidget.test.jsx.snap | 4 +- .../ObjectBrowserWidget.test.jsx.snap | 4 +- .../ObjectListWidget.test.jsx.snap | 16 +- .../__snapshots__/ObjectWidget.test.jsx.snap | 2 +- .../PasswordWidget.test.jsx.snap | 2 +- .../QuerystringWidget.test.jsx.snap | 72 +- .../ReferenceWidget.test.jsx.snap | 4 +- .../RegistryImageWidget.test.jsx.snap | 36 +- .../__snapshots__/SchemaWidget.test.jsx.snap | 2 +- .../SchemaWidgetFieldset.test.jsx.snap | 2 +- .../SelectAutoComplete.test.jsx.snap | 4 +- .../__snapshots__/SelectWidget.test.jsx.snap | 12 +- .../__snapshots__/TextWidget.test.jsx.snap | 2 +- .../TextareaWidget.test.jsx.snap | 2 +- .../__snapshots__/TokenWidget.test.jsx.snap | 14 +- .../__snapshots__/UrlWidget.test.jsx.snap | 4 +- .../VocabularyTermsWidget.test.jsx.snap | 16 +- .../manage/Workflow/Workflow.test.jsx | 13 +- .../__snapshots__/Workflow.test.jsx.snap | 6 +- packages/volto/vitest.config.js | 12 +- 212 files changed, 2048 insertions(+), 2622 deletions(-) create mode 100644 packages/volto/.i18nrc.js diff --git a/packages/volto/.editorconfig b/packages/volto/.editorconfig index 6c43b88c57..b25137d488 100644 --- a/packages/volto/.editorconfig +++ b/packages/volto/.editorconfig @@ -32,3 +32,4 @@ indent_size = 2 indent_style = tab indent_size = unset tab_width = unset + diff --git a/packages/volto/.eslintignore b/packages/volto/.eslintignore index 4d8f67cb11..b1f74e9f94 100644 --- a/packages/volto/.eslintignore +++ b/packages/volto/.eslintignore @@ -1 +1,4 @@ /types/ +.i18nrc.js +build/ +dist/ diff --git a/packages/volto/.eslintrc b/packages/volto/.eslintrc index 992df17e6f..03d4f7da68 100644 --- a/packages/volto/.eslintrc +++ b/packages/volto/.eslintrc @@ -91,5 +91,7 @@ "jest": true, "socket": true, "webpackIsomorphicTools": true, + "vitest":true, + "vi":true }, } diff --git a/packages/volto/.i18nrc.js b/packages/volto/.i18nrc.js new file mode 100644 index 0000000000..fe10dec404 --- /dev/null +++ b/packages/volto/.i18nrc.js @@ -0,0 +1,10 @@ +/* eslint-disable */ +module.exports = { + locales: ['en'], + extractMessages: true, + outputFilePattern: 'build/messages/messages.json', + inputFilePattern: [ + 'src/**/*.{js,jsx,ts,tsx}', + '__tests__/**/*.{js,jsx,ts,tsx}', + ], +}; diff --git a/packages/volto/__tests__/addon-registry-project.test.js b/packages/volto/__tests__/addon-registry-project.test.js index 459442b64b..aff9a18d46 100644 --- a/packages/volto/__tests__/addon-registry-project.test.js +++ b/packages/volto/__tests__/addon-registry-project.test.js @@ -4,22 +4,22 @@ import { buildDependencyGraph, getAddonsLoaderChain, } from '@plone/registry/addon-registry'; +import { vi, expect, describe, test, beforeEach, afterEach } from 'vitest'; describe('AddonRegistry - Project', () => { - jest.mock( + vi.mock( `${path.join( __dirname, 'fixtures', 'test-volto-project', )}/node_modules/@plone/volto/package.json`, () => ({ - // TODO: mock the packages folder inside the mocked @plone/volto to work with resolves coreAddons: {}, }), { virtual: true }, ); - it('works in a mock project directory', () => { + test('works in a mock project directory', () => { const base = path.join(__dirname, 'fixtures', 'test-volto-project'); const { registry } = AddonRegistry.init(base); @@ -102,7 +102,7 @@ describe('AddonRegistry - Project', () => { }); }); - it('provides aliases for addons', () => { + test('provides aliases for addons', () => { const base = path.join(__dirname, 'fixtures', 'test-volto-project'); const { registry } = AddonRegistry.init(base); expect(registry.getResolveAliases()).toStrictEqual({ @@ -115,13 +115,13 @@ describe('AddonRegistry - Project', () => { }); }); - it('provides addon extenders', () => { + test('provides addon extenders', () => { const base = path.join(__dirname, 'fixtures', 'test-volto-project'); const { registry } = AddonRegistry.init(base); expect(registry.getAddonExtenders().length).toBe(1); }); - it('provides a list of addon records ordered by initial package declaration', () => { + test('provides a list of addon records ordered by initial package declaration', () => { const base = path.join(__dirname, 'fixtures', 'test-volto-project'); const { registry } = AddonRegistry.init(base); const addons = registry.getAddons(); @@ -135,7 +135,7 @@ describe('AddonRegistry - Project', () => { ]); }); - it('provides customization paths declared in a Volto project', () => { + test('provides customization paths declared in a Volto project', () => { const base = path.join(__dirname, 'fixtures', 'test-volto-project'); const { registry } = AddonRegistry.init(base); expect(registry.getProjectCustomizationPaths()).toStrictEqual({ @@ -148,7 +148,7 @@ describe('AddonRegistry - Project', () => { }); }); - it('provides customization paths declared in addons', () => { + test('provides customization paths declared in addons', () => { const base = path.join(__dirname, 'fixtures', 'test-volto-project'); const { registry } = AddonRegistry.init(base); expect(registry.getAddonCustomizationPaths()).toStrictEqual({ @@ -220,7 +220,7 @@ describe('Addon via env var - Released addon', () => { const originalEnv = process.env; beforeEach(() => { - jest.resetModules(); + vi.resetModules(); process.env = { ...originalEnv, ADDONS: 'test-released-via-addons-env-var', @@ -231,7 +231,7 @@ describe('Addon via env var - Released addon', () => { process.env = originalEnv; }); - it('addons can be specified on the fly using ADDONS env var - Released addon', () => { + test('addons can be specified on the fly using ADDONS env var - Released addon', () => { const base = path.join(__dirname, 'fixtures', 'test-volto-project'); const { registry } = AddonRegistry.init(base); expect( diff --git a/packages/volto/__tests__/addon-registry-volto.test.js b/packages/volto/__tests__/addon-registry-volto.test.js index 79fc58af0d..62e3ae2f9c 100644 --- a/packages/volto/__tests__/addon-registry-volto.test.js +++ b/packages/volto/__tests__/addon-registry-volto.test.js @@ -1,5 +1,6 @@ import path from 'path'; import { AddonRegistry } from '@plone/registry/addon-registry'; +import { describe, expect, it } from 'vitest'; describe('AddonRegistry - Volto', () => { it('works in Volto', () => { diff --git a/packages/volto/__tests__/create-addons-loader.test.js b/packages/volto/__tests__/create-addons-loader.test.js index dfe9d174cb..770987a8c8 100644 --- a/packages/volto/__tests__/create-addons-loader.test.js +++ b/packages/volto/__tests__/create-addons-loader.test.js @@ -5,6 +5,7 @@ import { getAddonsLoaderCode, nameFromPackage, } from '@plone/registry/create-addons-loader'; +import { describe, expect } from 'vitest'; describe('create-addons-loader code generation', () => { test('no addon creates simple loader, default = no loadProjectConfig', () => { diff --git a/packages/volto/__tests__/volto-slate/deserialize.test.js b/packages/volto/__tests__/volto-slate/deserialize.test.js index 4ccea708a4..7e482a40d5 100644 --- a/packages/volto/__tests__/volto-slate/deserialize.test.js +++ b/packages/volto/__tests__/volto-slate/deserialize.test.js @@ -1,10 +1,10 @@ import config from '@plone/volto/registry'; - import { JSDOM } from 'jsdom'; import { deserialize } from '@plone/volto-slate/editor/deserialize'; import * as htmlUtils from '@plone/volto-slate/editor/utils'; import { makeEditor } from '@plone/volto-slate/utils/editor'; import installSlate from '@plone/volto-slate/index'; +import { it, describe, expect } from 'vitest'; const tojson = (html) => { const parsed = new JSDOM(html); diff --git a/packages/volto/__tests__/webpack-relative-resolver.test.js b/packages/volto/__tests__/webpack-relative-resolver.test.js index cc91dbfb4f..a2e5c84fc1 100644 --- a/packages/volto/__tests__/webpack-relative-resolver.test.js +++ b/packages/volto/__tests__/webpack-relative-resolver.test.js @@ -1,3 +1,4 @@ +import { describe, it, expect } from 'vitest'; const path = require('path'); const { AddonRegistry } = require('@plone/registry/addon-registry'); const WebpackRelativeResolver = require('../../volto/webpack-plugins/webpack-relative-resolver'); diff --git a/packages/volto/package.json b/packages/volto/package.json index e002402afd..854f0cd6c9 100644 --- a/packages/volto/package.json +++ b/packages/volto/package.json @@ -55,8 +55,8 @@ "stylelint:fix": "yarn stylelint --fix && yarn stylelint:overrides --fix", "lint": "eslint --max-warnings=0 'src/**/*.{js,jsx,ts,tsx,json}'", "lint:fix": "eslint --fix 'src/**/*.{js,jsx,ts,tsx,json}'", - "lint:husky": "eslint --max-warnings=0 --fix", - "i18n": "rm -rf build/messages && NODE_ENV=production i18n", + "lint:husky": "eslint --max-warnings=1 --fix", + "i18n": "NODE_ENV=production i18n", "i18n:ci": "pnpm i18n && git diff -G'^[^\"POT]' --exit-code", "typecheck": "tsc --project tsconfig.json --noEmit", "dry-release": "release-it --dry-run", diff --git a/packages/volto/src/components/manage/Actions/Actions.test.jsx b/packages/volto/src/components/manage/Actions/Actions.test.jsx index d66f98dabb..0e4856b2a1 100644 --- a/packages/volto/src/components/manage/Actions/Actions.test.jsx +++ b/packages/volto/src/components/manage/Actions/Actions.test.jsx @@ -8,7 +8,7 @@ import Actions from './Actions'; const mockStore = configureStore(); -jest.mock('@plone/volto/components/manage/Contents'); +vi.mock('@plone/volto/components/manage/Contents'); describe('Actions', () => { it('renders an actions component', () => { diff --git a/packages/volto/src/components/manage/Actions/__snapshots__/Actions.test.jsx.snap b/packages/volto/src/components/manage/Actions/__snapshots__/Actions.test.jsx.snap index db5940cde3..03c0135fc3 100644 --- a/packages/volto/src/components/manage/Actions/__snapshots__/Actions.test.jsx.snap +++ b/packages/volto/src/components/manage/Actions/__snapshots__/Actions.test.jsx.snap @@ -1,6 +1,6 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`Actions renders an actions component 1`] = ` +exports[`Actions > renders an actions component 1`] = `
{ config.settings.loadables = {}; }); -jest.mock('../Toolbar/Toolbar', () => jest.fn(() =>
)); +vi.mock('../Toolbar/Toolbar', () => ({ + __esModule: true, + default: vi.fn(() =>
), +})); -jest.mock('../Form/Form', () => jest.fn(() =>
)); +vi.mock('../Form/Form', () => ({ + __esModule: true, + default: vi.fn(() =>
), +})); describe('Add', () => { it('renders an empty add component', () => { diff --git a/packages/volto/src/components/manage/Add/__snapshots__/Add.test.jsx.snap b/packages/volto/src/components/manage/Add/__snapshots__/Add.test.jsx.snap index e0b4e6d306..b3254dd098 100644 --- a/packages/volto/src/components/manage/Add/__snapshots__/Add.test.jsx.snap +++ b/packages/volto/src/components/manage/Add/__snapshots__/Add.test.jsx.snap @@ -1,18 +1,18 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`Add renders an add component 1`] = ` +exports[`Add > renders an add component 1`] = `
`; -exports[`Add renders an add component with schema 1`] = ` +exports[`Add > renders an add component with schema 1`] = `
`; -exports[`Add renders an empty add component 1`] = ` +exports[`Add > renders an empty add component 1`] = `
diff --git a/packages/volto/src/components/manage/Aliases/Aliases.test.jsx b/packages/volto/src/components/manage/Aliases/Aliases.test.jsx index 3ded78f739..96cd40e462 100644 --- a/packages/volto/src/components/manage/Aliases/Aliases.test.jsx +++ b/packages/volto/src/components/manage/Aliases/Aliases.test.jsx @@ -9,9 +9,15 @@ import Aliases from './Aliases'; const middlewares = [thunk]; const mockStore = configureMockStore(middlewares); -jest.mock('../Toolbar/Toolbar', () => jest.fn(() =>
)); +vi.mock('../Toolbar/Toolbar', () => ({ + __esModule: true, + default: vi.fn(() =>
), +})); -jest.mock('../Toolbar/More', () => jest.fn(() =>
)); +vi.mock('../Toolbar/More', () => ({ + __esModule: true, + default: vi.fn(() =>
), +})); describe('Aliases', () => { it('renders aliases object control', () => { diff --git a/packages/volto/src/components/manage/Aliases/__snapshots__/Aliases.test.jsx.snap b/packages/volto/src/components/manage/Aliases/__snapshots__/Aliases.test.jsx.snap index 5bfa3e94a7..e3a356c2f1 100644 --- a/packages/volto/src/components/manage/Aliases/__snapshots__/Aliases.test.jsx.snap +++ b/packages/volto/src/components/manage/Aliases/__snapshots__/Aliases.test.jsx.snap @@ -1,6 +1,6 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`Aliases renders aliases object control 1`] = ` +exports[`Aliases > renders aliases object control 1`] = `
Fallback BlockChooser component onMutateBlock 1`] = `
@@ -111,8 +109,6 @@ exports[`BlocksChooser Fallback BlockChooser component onMutateBlock 1`] = `
@@ -154,8 +150,6 @@ exports[`BlocksChooser Fallback BlockChooser component onMutateBlock 1`] = `
@@ -223,8 +217,6 @@ exports[`BlocksChooser Fallback BlockChooser component onMutateBlock 1`] = `
@@ -325,7 +317,7 @@ exports[`BlocksChooser Fallback BlockChooser component onMutateBlock 1`] = `
`; -exports[`BlocksChooser renders a BlockChooser component 1`] = ` +exports[`BlocksChooser > renders a BlockChooser component 1`] = `
@@ -436,8 +426,6 @@ exports[`BlocksChooser renders a BlockChooser component 1`] = `
@@ -479,8 +467,6 @@ exports[`BlocksChooser renders a BlockChooser component 1`] = `
@@ -548,8 +534,6 @@ exports[`BlocksChooser renders a BlockChooser component 1`] = `
diff --git a/packages/volto/src/components/manage/BlockChooser/__snapshots__/BlockChooserButton.test.jsx.snap b/packages/volto/src/components/manage/BlockChooser/__snapshots__/BlockChooserButton.test.jsx.snap index cb9d6b9b3c..7de7f90af0 100644 --- a/packages/volto/src/components/manage/BlockChooser/__snapshots__/BlockChooserButton.test.jsx.snap +++ b/packages/volto/src/components/manage/BlockChooser/__snapshots__/BlockChooserButton.test.jsx.snap @@ -1,4 +1,4 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`Can render a custom button 1`] = `
@@ -19,8 +19,6 @@ exports[`Renders a button 1`] = `
diff --git a/packages/volto/src/components/manage/BlockChooser/__snapshots__/BlockChooserSearch.test.jsx.snap b/packages/volto/src/components/manage/BlockChooser/__snapshots__/BlockChooserSearch.test.jsx.snap index c6957f6789..e5899c902c 100644 --- a/packages/volto/src/components/manage/BlockChooser/__snapshots__/BlockChooserSearch.test.jsx.snap +++ b/packages/volto/src/components/manage/BlockChooser/__snapshots__/BlockChooserSearch.test.jsx.snap @@ -1,6 +1,6 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`BlocksChooserSearch renders a BlockChooserSearch component 1`] = ` +exports[`BlocksChooserSearch > renders a BlockChooserSearch component 1`] = `
- await require('@plone/volto/helpers/Loadable/Loadable').__setLoadables(), -); +vi.mock('@plone/volto/helpers/Loadable/Loadable'); +beforeAll(async () => { + await __setLoadables(); +}); let mockSerial = 0; - -jest.mock('uuid', () => { +vi.mock('uuid', () => { return { - v4: jest.fn().mockImplementation(() => `id-${mockSerial++}`), + v4: vi.fn().mockImplementation(() => `id-${mockSerial++}`), }; }); +vi.mock('react-beautiful-dnd', () => ({ + DragDropContext: ({ children }) =>
{children}
, + Droppable: ({ children }) => + children({ + innerRef: () => {}, + droppableProps: {}, + placeholder:
, + }), + Draggable: ({ children }) => + children({ + innerRef: () => {}, + draggableProps: {}, + dragHandleProps: {}, + }), +})); + +vi.mock('./Order/Order', () => ({ + __esModule: true, + default: () =>
Order Component
, +})); + const mockStore = configureStore(); test('Allow override of blocksConfig', () => { @@ -70,10 +90,13 @@ test('Allow override of blocksConfig', () => { const { container } = render( - - +
+ + +
, ); + expect(container).toMatchSnapshot(); }); @@ -88,7 +111,7 @@ test('Removes invalid blocks on saving', () => { }, }); - const onChangeFormData = jest.fn(() => {}); + const onChangeFormData = vi.fn(() => {}); const data = { pathname: '/test', @@ -126,18 +149,22 @@ test('Removes invalid blocks on saving', () => { render( - - +
+ + +
, ); - expect(onChangeFormData).toBeCalledWith({ + + expect(onChangeFormData).toHaveBeenCalledWith({ blocks: { a: { '@type': 'custom', text: 'a' }, b: { '@type': 'custom', text: 'b' }, }, blocks_layout: { items: ['a', 'b', 'MISSING-YOU-1'] }, }); - expect(onChangeFormData).toBeCalledWith({ + + expect(onChangeFormData).toHaveBeenCalledWith({ blocks: { a: { '@type': 'custom', text: 'a' }, b: { '@type': 'custom', text: 'b' }, diff --git a/packages/volto/src/components/manage/Blocks/Block/Settings.test.jsx b/packages/volto/src/components/manage/Blocks/Block/Settings.test.jsx index 237b53d556..691ec8ac45 100644 --- a/packages/volto/src/components/manage/Blocks/Block/Settings.test.jsx +++ b/packages/volto/src/components/manage/Blocks/Block/Settings.test.jsx @@ -5,7 +5,7 @@ import configureStore from 'redux-mock-store'; import config from '@plone/volto/registry'; import { Provider } from 'react-intl-redux'; -jest.mock('@plone/volto/components/manage/Form'); +vi.mock('@plone/volto/components/manage/Form'); const mockStore = configureStore(); diff --git a/packages/volto/src/components/manage/Blocks/Block/__snapshots__/BlocksForm.test.jsx.snap b/packages/volto/src/components/manage/Blocks/Block/__snapshots__/BlocksForm.test.jsx.snap index 15c1cb7e5b..49d86fd199 100644 --- a/packages/volto/src/components/manage/Blocks/Block/__snapshots__/BlocksForm.test.jsx.snap +++ b/packages/volto/src/components/manage/Blocks/Block/__snapshots__/BlocksForm.test.jsx.snap @@ -1,264 +1,107 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`Allow override of blocksConfig 1`] = `
- - diff --git a/packages/volto/src/components/manage/Blocks/Block/__snapshots__/Settings.test.jsx.snap b/packages/volto/src/components/manage/Blocks/Block/__snapshots__/Settings.test.jsx.snap index a629ca9637..828be02889 100644 --- a/packages/volto/src/components/manage/Blocks/Block/__snapshots__/Settings.test.jsx.snap +++ b/packages/volto/src/components/manage/Blocks/Block/__snapshots__/Settings.test.jsx.snap @@ -1,18 +1,18 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`Settings renders block settings form without schema enhancers 1`] = ` +exports[`Settings > renders block settings form without schema enhancers 1`] = `
diff --git a/packages/volto/src/components/manage/Blocks/Block/__snapshots__/Style.test.jsx.snap b/packages/volto/src/components/manage/Blocks/Block/__snapshots__/Style.test.jsx.snap index 0700027250..3ed213bc44 100644 --- a/packages/volto/src/components/manage/Blocks/Block/__snapshots__/Style.test.jsx.snap +++ b/packages/volto/src/components/manage/Blocks/Block/__snapshots__/Style.test.jsx.snap @@ -1,4 +1,4 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`renders a Style wrapper component 1`] = `
{ +it('renders a view description component', () => { const component = renderer.create( , ); diff --git a/packages/volto/src/components/manage/Blocks/Description/__snapshots__/Edit.test.jsx.snap b/packages/volto/src/components/manage/Blocks/Description/__snapshots__/Edit.test.jsx.snap index b8923b8673..92c31ee424 100644 --- a/packages/volto/src/components/manage/Blocks/Description/__snapshots__/Edit.test.jsx.snap +++ b/packages/volto/src/components/manage/Blocks/Description/__snapshots__/Edit.test.jsx.snap @@ -1,6 +1,6 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`renders edit blocks renders an edit description block component 1`] = ` +exports[`renders edit blocks > renders an edit description block component 1`] = `
- await require('@plone/volto/helpers/Loadable/Loadable').__setLoadables(), -); +vi.mock('@plone/volto/helpers/Loadable/Loadable'); +beforeAll(async () => { + await __setLoadables(); +}); test('renders an edit html block component', async () => { const store = mockStore({ content: { diff --git a/packages/volto/src/components/manage/Blocks/HTML/View.test.jsx b/packages/volto/src/components/manage/Blocks/HTML/View.test.jsx index 9696598e4f..eaf555d5a2 100644 --- a/packages/volto/src/components/manage/Blocks/HTML/View.test.jsx +++ b/packages/volto/src/components/manage/Blocks/HTML/View.test.jsx @@ -2,7 +2,7 @@ import React from 'react'; import renderer from 'react-test-renderer'; import View from './View'; -test('renders a view html component', () => { +it('renders a view html component', () => { const component = renderer.create(' }} />); const json = component.toJSON(); expect(json).toMatchSnapshot(); diff --git a/packages/volto/src/components/manage/Blocks/HTML/__snapshots__/Edit.test.jsx.snap b/packages/volto/src/components/manage/Blocks/HTML/__snapshots__/Edit.test.jsx.snap index 986f25f55f..4d2d46e1c5 100644 --- a/packages/volto/src/components/manage/Blocks/HTML/__snapshots__/Edit.test.jsx.snap +++ b/packages/volto/src/components/manage/Blocks/HTML/__snapshots__/Edit.test.jsx.snap @@ -1,4 +1,4 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`renders an edit html block component 1`] = `
diff --git a/packages/volto/src/components/manage/Blocks/HTML/__snapshots__/View.test.jsx.snap b/packages/volto/src/components/manage/Blocks/HTML/__snapshots__/View.test.jsx.snap index 683c4a9c3b..b5019fceb3 100644 --- a/packages/volto/src/components/manage/Blocks/HTML/__snapshots__/View.test.jsx.snap +++ b/packages/volto/src/components/manage/Blocks/HTML/__snapshots__/View.test.jsx.snap @@ -1,10 +1,10 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`renders a view html component 1`] = `
", } } diff --git a/packages/volto/src/components/manage/Blocks/Image/ImageSidebar.test.jsx b/packages/volto/src/components/manage/Blocks/Image/ImageSidebar.test.jsx index 725237aff8..7ff7661781 100644 --- a/packages/volto/src/components/manage/Blocks/Image/ImageSidebar.test.jsx +++ b/packages/volto/src/components/manage/Blocks/Image/ImageSidebar.test.jsx @@ -5,11 +5,11 @@ import { Provider } from 'react-intl-redux'; import ImageSidebar from './ImageSidebar'; -jest.mock('@plone/volto/components/manage/Form'); +vi.mock('@plone/volto/components/manage/Form'); const mockStore = configureStore(); -test('renders an Image Block Sidebar component', () => { +it('renders an Image Block Sidebar component', () => { const store = mockStore({ content: { create: {}, diff --git a/packages/volto/src/components/manage/Blocks/Image/__snapshots__/Edit.test.jsx.snap b/packages/volto/src/components/manage/Blocks/Image/__snapshots__/Edit.test.jsx.snap index e8bb67c40c..72ac44502c 100644 --- a/packages/volto/src/components/manage/Blocks/Image/__snapshots__/Edit.test.jsx.snap +++ b/packages/volto/src/components/manage/Blocks/Image/__snapshots__/Edit.test.jsx.snap @@ -1,4 +1,4 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`renders an edit image block component 1`] = `
@@ -19,20 +19,18 @@ Array [
@@ -51,7 +49,7 @@ Array [ sizes="188px" src="image" style={ - Object { + { "width": "50%", } } @@ -59,56 +57,56 @@ Array [
,
, diff --git a/packages/volto/src/components/manage/Blocks/LeadImage/LeadImageSidebar.test.jsx b/packages/volto/src/components/manage/Blocks/LeadImage/LeadImageSidebar.test.jsx index 6eb8e5e98e..4cae6600cf 100644 --- a/packages/volto/src/components/manage/Blocks/LeadImage/LeadImageSidebar.test.jsx +++ b/packages/volto/src/components/manage/Blocks/LeadImage/LeadImageSidebar.test.jsx @@ -5,7 +5,7 @@ import { Provider } from 'react-intl-redux'; import LeadImageSidebar from './LeadImageSidebar'; -jest.mock('@plone/volto/components/manage/Widgets'); +vi.mock('@plone/volto/components/manage/Widgets'); const mockStore = configureStore(); @@ -16,6 +16,7 @@ test('renders a Lead Image block Sidebar component', () => { messages: {}, }, }); + const component = renderer.create( { /> , ); + const json = component.toJSON(); expect(json).toMatchSnapshot(); }); diff --git a/packages/volto/src/components/manage/Blocks/LeadImage/__snapshots__/Edit.test.jsx.snap b/packages/volto/src/components/manage/Blocks/LeadImage/__snapshots__/Edit.test.jsx.snap index e4b47a0eab..bb09756ce2 100644 --- a/packages/volto/src/components/manage/Blocks/LeadImage/__snapshots__/Edit.test.jsx.snap +++ b/packages/volto/src/components/manage/Blocks/LeadImage/__snapshots__/Edit.test.jsx.snap @@ -1,4 +1,4 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`renders an edit Lead Image block component 1`] = `
@@ -98,20 +96,18 @@ exports[`renders a Lead Image block Sidebar component 1`] = `
@@ -126,20 +122,18 @@ exports[`renders a Lead Image block Sidebar component 1`] = `
@@ -154,20 +148,18 @@ exports[`renders a Lead Image block Sidebar component 1`] = `
@@ -188,20 +180,18 @@ exports[`renders a Lead Image block Sidebar component 1`] = `
jest.fn(() =>
)); +vi.mock('./ListingBody', () => ({ + default: () =>
, +})); test('renders a view image component for the listing block', () => { const component = renderer.create( diff --git a/packages/volto/src/components/manage/Blocks/Listing/__snapshots__/ListingBody.test.jsx.snap b/packages/volto/src/components/manage/Blocks/Listing/__snapshots__/ListingBody.test.jsx.snap index 5fa1511b42..6382d639d1 100644 --- a/packages/volto/src/components/manage/Blocks/Listing/__snapshots__/ListingBody.test.jsx.snap +++ b/packages/volto/src/components/manage/Blocks/Listing/__snapshots__/ListingBody.test.jsx.snap @@ -1,4 +1,4 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`renders a ListingBody component 1`] = `
-
-

- Listing -

-
-
-
-
- Variation - - - No description -
-
- Headline - - - No description -
-
- Headline level - - - No description -
-
- Query - - - No description -
-
-
-
-`; +exports[`renders an Listing Data Sidebar component 1`] = `null`; diff --git a/packages/volto/src/components/manage/Blocks/Listing/__snapshots__/View.test.jsx.snap b/packages/volto/src/components/manage/Blocks/Listing/__snapshots__/View.test.jsx.snap index 14144486ec..a0218f5abb 100644 --- a/packages/volto/src/components/manage/Blocks/Listing/__snapshots__/View.test.jsx.snap +++ b/packages/volto/src/components/manage/Blocks/Listing/__snapshots__/View.test.jsx.snap @@ -1,4 +1,4 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`renders a view image component for the listing block 1`] = `
diff --git a/packages/volto/src/components/manage/Blocks/Maps/__snapshots__/View.test.jsx.snap b/packages/volto/src/components/manage/Blocks/Maps/__snapshots__/View.test.jsx.snap index 70cb9c2201..bdfd7e108a 100644 --- a/packages/volto/src/components/manage/Blocks/Maps/__snapshots__/View.test.jsx.snap +++ b/packages/volto/src/components/manage/Blocks/Maps/__snapshots__/View.test.jsx.snap @@ -1,4 +1,4 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`renders a view map component 1`] = `
- await require('@plone/volto/helpers/Loadable/Loadable').__setLoadables(), -); +vi.mock('@plone/volto/helpers/Loadable/Loadable'); +beforeAll(async () => { + await __setLoadables(); +}); -describe('DateRangeFaceg', () => { +describe('DateRangeFacet', () => { it('renders a facet component with a date range widget', async () => { const store = mockStore({ userSession: { token: null }, diff --git a/packages/volto/src/components/manage/Blocks/Search/components/SelectFacet.test.jsx b/packages/volto/src/components/manage/Blocks/Search/components/SelectFacet.test.jsx index 65e1704454..7f484f7b21 100644 --- a/packages/volto/src/components/manage/Blocks/Search/components/SelectFacet.test.jsx +++ b/packages/volto/src/components/manage/Blocks/Search/components/SelectFacet.test.jsx @@ -2,16 +2,15 @@ import React from 'react'; import configureStore from 'redux-mock-store'; import { Provider } from 'react-intl-redux'; import { waitFor, render, screen } from '@testing-library/react'; - +import { __setLoadables } from '@plone/volto/helpers/Loadable/Loadable'; import SelectFacet from './SelectFacet'; const mockStore = configureStore(); -jest.mock('@plone/volto/helpers/Loadable/Loadable'); -beforeAll( - async () => - await require('@plone/volto/helpers/Loadable/Loadable').__setLoadables(), -); +vi.mock('@plone/volto/helpers/Loadable/Loadable'); +beforeAll(async () => { + await __setLoadables(); +}); describe('SelectFacet', () => { it('renders a facet component with select dropdown', async () => { diff --git a/packages/volto/src/components/manage/Blocks/Search/components/__snapshots__/CheckboxFacet.test.jsx.snap b/packages/volto/src/components/manage/Blocks/Search/components/__snapshots__/CheckboxFacet.test.jsx.snap index a4505d82d8..3f7a471e71 100644 --- a/packages/volto/src/components/manage/Blocks/Search/components/__snapshots__/CheckboxFacet.test.jsx.snap +++ b/packages/volto/src/components/manage/Blocks/Search/components/__snapshots__/CheckboxFacet.test.jsx.snap @@ -1,6 +1,6 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`CheckboxFacet renders a facet component with checkboxes 1`] = ` +exports[`CheckboxFacet > renders a facet component with checkboxes 1`] = `
diff --git a/packages/volto/src/components/manage/Blocks/Search/components/__snapshots__/DateRangeFacet.test.jsx.snap b/packages/volto/src/components/manage/Blocks/Search/components/__snapshots__/DateRangeFacet.test.jsx.snap index ca301c3086..dc3baad19d 100644 --- a/packages/volto/src/components/manage/Blocks/Search/components/__snapshots__/DateRangeFacet.test.jsx.snap +++ b/packages/volto/src/components/manage/Blocks/Search/components/__snapshots__/DateRangeFacet.test.jsx.snap @@ -1,6 +1,6 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`DateRangeFaceg renders a facet component with a date range widget 1`] = ` +exports[`DateRangeFacet > renders a facet component with a date range widget 1`] = `
diff --git a/packages/volto/src/components/manage/Blocks/Search/components/__snapshots__/FilterList.test.jsx.snap b/packages/volto/src/components/manage/Blocks/Search/components/__snapshots__/FilterList.test.jsx.snap index 16cd91133f..3704a5a20f 100644 --- a/packages/volto/src/components/manage/Blocks/Search/components/__snapshots__/FilterList.test.jsx.snap +++ b/packages/volto/src/components/manage/Blocks/Search/components/__snapshots__/FilterList.test.jsx.snap @@ -1,6 +1,6 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`FilterList renders filters listing component for search block 1`] = ` +exports[`FilterList > renders filters listing component for search block 1`] = `
@@ -14,20 +14,18 @@ exports[`FilterList renders filters listing component for search block 1`] = ` Current filters applied : diff --git a/packages/volto/src/components/manage/Blocks/Search/components/__snapshots__/SearchDetails.test.jsx.snap b/packages/volto/src/components/manage/Blocks/Search/components/__snapshots__/SearchDetails.test.jsx.snap index e1a3f1a3af..cf4793d69d 100644 --- a/packages/volto/src/components/manage/Blocks/Search/components/__snapshots__/SearchDetails.test.jsx.snap +++ b/packages/volto/src/components/manage/Blocks/Search/components/__snapshots__/SearchDetails.test.jsx.snap @@ -1,6 +1,6 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`SearchDetails renders search detail component 1`] = ` +exports[`SearchDetails > renders search detail component 1`] = `

diff --git a/packages/volto/src/components/manage/Blocks/Search/components/__snapshots__/SearchInput.test.jsx.snap b/packages/volto/src/components/manage/Blocks/Search/components/__snapshots__/SearchInput.test.jsx.snap index 96f30dbefc..e345b4bd2a 100644 --- a/packages/volto/src/components/manage/Blocks/Search/components/__snapshots__/SearchInput.test.jsx.snap +++ b/packages/volto/src/components/manage/Blocks/Search/components/__snapshots__/SearchInput.test.jsx.snap @@ -1,6 +1,6 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`SearchInput renders a search input component 1`] = ` +exports[`SearchInput > renders a search input component 1`] = `
@@ -26,20 +26,18 @@ exports[`SearchInput renders a search input component 1`] = `
diff --git a/packages/volto/src/components/manage/Blocks/Search/components/__snapshots__/SelectFacet.test.jsx.snap b/packages/volto/src/components/manage/Blocks/Search/components/__snapshots__/SelectFacet.test.jsx.snap index a4353d7115..78f5dda72a 100644 --- a/packages/volto/src/components/manage/Blocks/Search/components/__snapshots__/SelectFacet.test.jsx.snap +++ b/packages/volto/src/components/manage/Blocks/Search/components/__snapshots__/SelectFacet.test.jsx.snap @@ -1,6 +1,6 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`SelectFacet renders a facet component with select dropdown 1`] = ` +exports[`SelectFacet > renders a facet component with select dropdown 1`] = `
diff --git a/packages/volto/src/components/manage/Blocks/Title/__snapshots__/Edit.test.jsx.snap b/packages/volto/src/components/manage/Blocks/Title/__snapshots__/Edit.test.jsx.snap index b6bc17f291..5a667ade56 100644 --- a/packages/volto/src/components/manage/Blocks/Title/__snapshots__/Edit.test.jsx.snap +++ b/packages/volto/src/components/manage/Blocks/Title/__snapshots__/Edit.test.jsx.snap @@ -1,6 +1,6 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`renders edit blocks renders an edit title block component 1`] = ` +exports[`renders edit blocks > renders an edit title block component 1`] = `
diff --git a/packages/volto/src/components/manage/Blocks/Video/__snapshots__/View.test.jsx.snap b/packages/volto/src/components/manage/Blocks/Video/__snapshots__/View.test.jsx.snap index 2352de6ea4..e3196563e8 100644 --- a/packages/volto/src/components/manage/Blocks/Video/__snapshots__/View.test.jsx.snap +++ b/packages/volto/src/components/manage/Blocks/Video/__snapshots__/View.test.jsx.snap @@ -1,4 +1,4 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html exports[`renders a view video component 1`] = `
renders a ConditionalLink component not link 1`] = `

Title

`; -exports[`ConditionalLink renders a ConditionalLink component with link 1`] = ` +exports[`ConditionalLink > renders a ConditionalLink component with link 1`] = `

Title

diff --git a/packages/volto/src/components/manage/Contents/Contents.test.jsx b/packages/volto/src/components/manage/Contents/Contents.test.jsx index 87982d36d4..a715439393 100644 --- a/packages/volto/src/components/manage/Contents/Contents.test.jsx +++ b/packages/volto/src/components/manage/Contents/Contents.test.jsx @@ -3,25 +3,27 @@ import { render } from '@testing-library/react'; import configureStore from 'redux-mock-store'; import { Provider } from 'react-intl-redux'; import { MemoryRouter } from 'react-router-dom'; +import { __setLoadables } from '@plone/volto/helpers/Loadable/Loadable'; import { __test__ as Contents } from './Contents'; const mockStore = configureStore(); -jest.mock('@plone/volto/helpers/Loadable/Loadable'); -beforeAll( - async () => - await require('@plone/volto/helpers/Loadable/Loadable').__setLoadables(), -); +vi.mock('@plone/volto/helpers/Loadable/Loadable'); +beforeAll(async () => { + await __setLoadables(); +}); -jest.mock('../Toolbar/Toolbar', () => jest.fn(() =>
)); +vi.mock('../Toolbar/Toolbar', () => ({ + default: vi.fn(() =>
), +})); -jest.mock('../../theme/Pagination/Pagination', () => - jest.fn(() =>
), -); -jest.mock('./ContentsUploadModal', () => - jest.fn(() =>
), -); +vi.mock('../../theme/Pagination/Pagination', () => ({ + default: vi.fn(() =>
), +})); +vi.mock('./ContentsUploadModal', () => ({ + default: vi.fn(() =>
), +})); describe('Contents', () => { it('renders a folder contents view component', () => { diff --git a/packages/volto/src/components/manage/Contents/ContentsPropertiesModal.test.jsx b/packages/volto/src/components/manage/Contents/ContentsPropertiesModal.test.jsx index f143096a37..43cc209dd4 100644 --- a/packages/volto/src/components/manage/Contents/ContentsPropertiesModal.test.jsx +++ b/packages/volto/src/components/manage/Contents/ContentsPropertiesModal.test.jsx @@ -7,7 +7,7 @@ import ContentsPropertiesModal from './ContentsPropertiesModal'; const mockStore = configureStore(); -jest.mock('@plone/volto/components/manage/Form'); +vi.mock('@plone/volto/components/manage/Form'); describe('ContentsPropertiesModal', () => { it('renders a contents properties modal component', () => { diff --git a/packages/volto/src/components/manage/Contents/ContentsRenameModal.test.jsx b/packages/volto/src/components/manage/Contents/ContentsRenameModal.test.jsx index 7d63a3aa86..a3e9fec30e 100644 --- a/packages/volto/src/components/manage/Contents/ContentsRenameModal.test.jsx +++ b/packages/volto/src/components/manage/Contents/ContentsRenameModal.test.jsx @@ -7,7 +7,7 @@ import ContentsRenameModal from './ContentsRenameModal'; const mockStore = configureStore(); -jest.mock('@plone/volto/components/manage/Form'); +vi.mock('@plone/volto/components/manage/Form'); describe('ContentsRenameModal', () => { it('renders a contents rename modal component', () => { diff --git a/packages/volto/src/components/manage/Contents/ContentsTagsModal.test.jsx b/packages/volto/src/components/manage/Contents/ContentsTagsModal.test.jsx index 976155a8a9..e913930796 100644 --- a/packages/volto/src/components/manage/Contents/ContentsTagsModal.test.jsx +++ b/packages/volto/src/components/manage/Contents/ContentsTagsModal.test.jsx @@ -7,7 +7,7 @@ import ContentsTagsModal from './ContentsTagsModal'; const mockStore = configureStore(); -jest.mock('@plone/volto/components/manage/Form'); +vi.mock('@plone/volto/components/manage/Form'); describe('ContentsTagsModal', () => { it('renders a contents tags modal component', () => { diff --git a/packages/volto/src/components/manage/Contents/ContentsWorkflowModal.test.jsx b/packages/volto/src/components/manage/Contents/ContentsWorkflowModal.test.jsx index 696107bd8a..7f532a68d8 100644 --- a/packages/volto/src/components/manage/Contents/ContentsWorkflowModal.test.jsx +++ b/packages/volto/src/components/manage/Contents/ContentsWorkflowModal.test.jsx @@ -7,7 +7,7 @@ import ContentsWorkflowModal from './ContentsWorkflowModal'; const mockStore = configureStore(); -jest.mock('@plone/volto/components/manage/Form'); +vi.mock('@plone/volto/components/manage/Form'); describe('ContentsWorkflowModal', () => { it('renders a contents workflow modal component', () => { diff --git a/packages/volto/src/components/manage/Contents/__mocks__/index.tsx b/packages/volto/src/components/manage/Contents/__mocks__/index.tsx index 6187049d16..a59ff9a99f 100644 --- a/packages/volto/src/components/manage/Contents/__mocks__/index.tsx +++ b/packages/volto/src/components/manage/Contents/__mocks__/index.tsx @@ -1,5 +1,6 @@ -export const Contents = jest.fn(() =>
); +import { vi } from 'vitest'; +export const Contents = vi.fn(() =>
); -export const ContentsRenameModal = jest.fn(() => ( +export const ContentsRenameModal = vi.fn(() => (
)); diff --git a/packages/volto/src/components/manage/Contents/__snapshots__/Contents.test.jsx.snap b/packages/volto/src/components/manage/Contents/__snapshots__/Contents.test.jsx.snap index 2c6dd5c65f..b51e80f2e4 100644 --- a/packages/volto/src/components/manage/Contents/__snapshots__/Contents.test.jsx.snap +++ b/packages/volto/src/components/manage/Contents/__snapshots__/Contents.test.jsx.snap @@ -1,6 +1,6 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`Contents renders a folder contents view component 1`] = ` +exports[`Contents > renders a folder contents view component 1`] = `
@@ -66,8 +64,6 @@ exports[`Contents renders a folder contents view component 1`] = `
@@ -114,8 +104,6 @@ exports[`Contents renders a folder contents view component 1`] = `
@@ -170,8 +152,6 @@ exports[`Contents renders a folder contents view component 1`] = `