@@ -3,7 +3,7 @@ import { render, screen, waitFor } from '@testing-library/react';
33import userEvent from '@testing-library/user-event' ;
44import { FormProvider , useForm } from 'react-hook-form' ;
55import { object , string } from 'yup' ;
6- import { TelField , TelFieldDataProps } from '../TelField' ;
6+ import { TelField , TelFieldProps } from '../TelField' ;
77import { TelFieldDefault } from '../default/TelFieldDefault' ;
88import { $TSFixMe } from '@/src/types/remoteFlows' ;
99import { yupResolver } from '@hookform/resolvers/yup' ;
@@ -39,7 +39,7 @@ async function fillPhoneInput(phoneNumber: string) {
3939 await user . type ( phoneInput , phoneNumber ) ;
4040}
4141
42- const mockOptions : TelFieldDataProps [ 'options' ] = [
42+ const mockOptions : TelFieldProps [ 'options' ] = [
4343 {
4444 value : 'US' ,
4545 label : 'United States' ,
@@ -66,7 +66,7 @@ const mockOptions: TelFieldDataProps['options'] = [
6666 } ,
6767] ;
6868
69- const createTelSchema = ( options : TelFieldDataProps [ 'options' ] ) => {
69+ const createTelSchema = ( options : TelFieldProps [ 'options' ] ) => {
7070 return string ( )
7171 . required ( 'Phone number is required' )
7272 . max ( 30 , 'Must be at most 30 characters' )
@@ -96,7 +96,7 @@ const createTelSchema = (options: TelFieldDataProps['options']) => {
9696} ;
9797
9898describe ( 'TelField Component - Split UI' , ( ) => {
99- const defaultProps : TelFieldDataProps = {
99+ const defaultProps : TelFieldProps = {
100100 name : 'phoneNumber' ,
101101 label : 'Phone Number' ,
102102 description : 'Enter your phone number' ,
@@ -113,18 +113,20 @@ describe('TelField Component - Split UI', () => {
113113 } ;
114114
115115 const renderWithFormContext = (
116- props : TelFieldDataProps ,
116+ props : TelFieldProps ,
117117 defaultValues ?: $TSFixMe ,
118118 ) => {
119119 const TestComponent = ( ) => {
120120 const methods = useForm ( {
121121 mode : 'onBlur' ,
122122 defaultValues : defaultValues || { } ,
123- resolver : yupResolver (
124- object ( ) . shape ( {
125- phoneNumber : props . schema ,
126- } ) ,
127- ) ,
123+ resolver : props . schema
124+ ? yupResolver (
125+ object ( ) . shape ( {
126+ phoneNumber : props . schema ,
127+ } ) ,
128+ )
129+ : undefined ,
128130 } ) ;
129131 return (
130132 < FormProvider { ...methods } >
0 commit comments