From a9e898eb7e4a7c0e7a0005e71e8282f2c49f3a2c Mon Sep 17 00:00:00 2001 From: Tania <38540885+crystal4000@users.noreply.github.com> Date: Wed, 24 Jul 2024 18:42:55 -0500 Subject: [PATCH] Feat:Test fix --- src/app/(auth-routes)/login/page.test.tsx | 42 +++++++++++++++-------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/src/app/(auth-routes)/login/page.test.tsx b/src/app/(auth-routes)/login/page.test.tsx index 30ae2d989..2480409b4 100644 --- a/src/app/(auth-routes)/login/page.test.tsx +++ b/src/app/(auth-routes)/login/page.test.tsx @@ -24,13 +24,15 @@ type FieldType = { }; vi.mock("~/components/ui/form", () => ({ - Form: ({ children }: { children: React.ReactNode }) =>
{children}
, - FormField: ({ + Form: function Form({ children }: { children: React.ReactNode }) { + return
{children}
; + }, + FormField: function FormField({ render, }: { render: (properties: { field: FieldType }) => React.ReactNode; - }) => - render({ + }) { + return render({ field: { onChange: vi.fn(), onBlur: vi.fn(), @@ -38,17 +40,27 @@ vi.mock("~/components/ui/form", () => ({ name: "", ref: () => {}, }, - }), - FormItem: ({ children }: { children: React.ReactNode }) => ( -
{children}
- ), - FormLabel: ({ children }: { children: React.ReactNode }) => ( - - ), - FormControl: ({ children }: { children: React.ReactNode }) => ( -
{children}
- ), - FormMessage: ({ children }: { children: React.ReactNode }) => children, + }); + }, + FormItem: function FormItem({ children }: { children: React.ReactNode }) { + return
{children}
; + }, + FormLabel: function FormLabel({ children }: { children: React.ReactNode }) { + return ; + }, + FormControl: React.forwardRef(function FormControl( + { children }: { children: React.ReactNode }, + reference: React.Ref, + ) { + return
{children}
; + }), + FormMessage: function FormMessage({ + children, + }: { + children: React.ReactNode; + }) { + return children; + }, })); vi.mock("~/components/ui/input", () => ({