From 66f3adf83f41c6ac3736de88bd17e4c96fc12143 Mon Sep 17 00:00:00 2001 From: Misha Holtz <36575242+mnholtz@users.noreply.github.com> Date: Wed, 13 Nov 2024 21:06:29 -0800 Subject: [PATCH] fix RichTextWidget tests --- .../widgets/RichTextWidget.test.tsx | 36 +++++++++++++------ 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/applications/browser-extension/src/components/formBuilder/widgets/RichTextWidget.test.tsx b/applications/browser-extension/src/components/formBuilder/widgets/RichTextWidget.test.tsx index 3f095c714a..012c5a8144 100644 --- a/applications/browser-extension/src/components/formBuilder/widgets/RichTextWidget.test.tsx +++ b/applications/browser-extension/src/components/formBuilder/widgets/RichTextWidget.test.tsx @@ -22,14 +22,26 @@ import CustomFormComponent, { type CustomFormComponentProps, } from "@/bricks/renderers/CustomFormComponent"; import { type Schema } from "@/types/schemaTypes"; +import { Provider } from "react-redux"; +import { configureStore } from "@reduxjs/toolkit"; +import { appApi } from "@/data/service/api"; +import { s3UploadApi } from "@/components/richTextEditor/toolbar/ImageButton/useUploadAsset"; describe("RichTextWidget", () => { const user = userEvent.setup({ - // 20ms delay between key presses to allow the editor state to update - // before the next key press delay: 20, }); + const createTestStore = () => + configureStore({ + reducer: { + appApi: appApi.reducer, + s3UploadApi: s3UploadApi.reducer, + }, + middleware: (getDefaultMiddleware) => + getDefaultMiddleware().concat(appApi.middleware), + }); + const createSchema = (properties: Record): Schema => ({ type: "object", properties, @@ -48,15 +60,19 @@ describe("RichTextWidget", () => { }: Pick & { onSubmit?: jest.Mock; }) => { + const store = createTestStore(); + render( - , + + + , ); return { onSubmit }; };