File tree 3 files changed +10
-6
lines changed
components/Form/FieldUpload
3 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ const mockFile: FieldUploadValue = {
17
17
lastModifiedDate : new Date ( mockFileRaw . lastModified ) ,
18
18
size : mockFileRaw . size . toString ( ) ,
19
19
type : mockFileRaw . type ,
20
- name : mockFileRaw . name ,
20
+ name : mockFileRaw . name ?? '' ,
21
21
} ;
22
22
23
23
test ( 'update value' , async ( ) => {
@@ -75,7 +75,7 @@ test('default value', async () => {
75
75
) ;
76
76
77
77
// Here we can use '!' on mockFile.name to prevent TS error because we are sure it is defined
78
- const input = screen . getByLabelText < HTMLInputElement > ( mockFile . name ! ) ;
78
+ const input = screen . getByLabelText < HTMLInputElement > ( mockFile . name ?? '' ) ;
79
79
expect ( input . files ? input . files [ 0 ] : [ ] ) . toBe ( undefined ) ;
80
80
await user . click ( screen . getByRole ( 'button' , { name : 'Submit' } ) ) ;
81
81
expect ( mockedSubmit ) . toHaveBeenCalledWith ( { file : mockFile } ) ;
Original file line number Diff line number Diff line change 1
1
import { ChangeEvent , ReactNode } from 'react' ;
2
2
3
- import { Icon , Spinner , chakra } from '@chakra-ui/react' ;
4
- import { Input , InputProps } from '@chakra-ui/react' ;
3
+ import {
4
+ Icon ,
5
+ Input ,
6
+ type InputProps ,
7
+ Spinner ,
8
+ chakra ,
9
+ } from '@chakra-ui/react' ;
5
10
import { Controller , FieldPath , FieldValues } from 'react-hook-form' ;
6
11
import { FiPaperclip } from 'react-icons/fi' ;
7
12
Original file line number Diff line number Diff line change 1
- import { useMutation } from '@tanstack/react-query' ;
2
- import { useQuery } from '@tanstack/react-query' ;
1
+ import { useMutation , useQuery } from '@tanstack/react-query' ;
3
2
4
3
import { trpc } from '@/lib/trpc/client' ;
5
4
You can’t perform that action at this time.
0 commit comments