@@ -34,9 +34,15 @@ const TaskFormModal: React.FC<TaskFormModalProps> = ({ task, status, onSubmit, m
3434 let schema ;
3535
3636 if ( status === TaskStatus . IN_PROGRESS ) {
37- console . log ( 'here' ) ;
3837 schema = yup . object ( ) . shape ( {
39- notes : yup . string ( ) . optional ( ) ,
38+ notes : yup
39+ . string ( )
40+ . optional ( )
41+ . test ( ( value ) => {
42+ if ( ! value ) return true ;
43+ const wordCount = countWords ( value ) ;
44+ return wordCount < 250 ;
45+ } ) ,
4046 startDate : yup . date ( ) . optional ( ) ,
4147 deadline : yup . date ( ) . required ( 'Deadline is required for In Progress tasks' ) ,
4248 priority : yup . mixed < TaskPriority > ( ) . oneOf ( Object . values ( TaskPriority ) ) . required ( ) ,
@@ -45,9 +51,15 @@ const TaskFormModal: React.FC<TaskFormModalProps> = ({ task, status, onSubmit, m
4551 taskId : yup . string ( ) . required ( )
4652 } ) ;
4753 } else {
48- console . log ( 'there' ) ;
4954 schema = yup . object ( ) . shape ( {
50- notes : yup . string ( ) . optional ( ) ,
55+ notes : yup
56+ . string ( )
57+ . optional ( )
58+ . test ( ( value ) => {
59+ if ( ! value ) return true ;
60+ const wordCount = countWords ( value ) ;
61+ return wordCount < 250 ;
62+ } ) ,
5163 startDate : yup . date ( ) . optional ( ) ,
5264 deadline : yup . date ( ) . optional ( ) ,
5365 priority : yup . mixed < TaskPriority > ( ) . oneOf ( Object . values ( TaskPriority ) ) . required ( ) ,
0 commit comments