File tree Expand file tree Collapse file tree 1 file changed +23
-18
lines changed
packages/openapi-react-query/test Expand file tree Collapse file tree 1 file changed +23
-18
lines changed Original file line number Diff line number Diff line change @@ -70,36 +70,41 @@ describe("client", () => {
70
70
71
71
const initialData = { title : "Initial data" , body : "Initial data" } ;
72
72
73
- const options = client . queryOptions ( "get" , "/blogposts/{post_id}" , {
74
- params : {
75
- path : {
76
- post_id : "1" ,
73
+ const options = client . queryOptions (
74
+ "get" ,
75
+ "/blogposts/{post_id}" ,
76
+ {
77
+ params : {
78
+ path : {
79
+ post_id : "1" ,
80
+ } ,
77
81
} ,
78
82
} ,
79
- } , {
80
- initialData : ( ) => initialData
81
- } )
83
+ {
84
+ initialData : ( ) => initialData ,
85
+ } ,
86
+ ) ;
82
87
83
- const data = queryClient . getQueryData ( options . queryKey ) ;
84
-
85
- expectTypeOf ( data ) . toEqualTypeOf < {
86
- title : string ;
87
- body : string ;
88
- publish_date ?: number ;
89
- } | undefined > ( ) ;
88
+ const data = queryClient . getQueryData ( options . queryKey ) ;
89
+
90
+ expectTypeOf ( data ) . toEqualTypeOf <
91
+ | {
92
+ title : string ;
93
+ body : string ;
94
+ publish_date ?: number ;
95
+ }
96
+ | undefined
97
+ > ( ) ;
90
98
expect ( data ) . toEqual ( undefined ) ;
91
99
92
- const { result } = renderHook ( ( ) => useQuery ( { ...options , enabled : false } ) , {
100
+ const { result } = renderHook ( ( ) => useQuery ( { ...options , enabled : false } ) , {
93
101
wrapper,
94
102
} ) ;
95
103
96
104
await waitFor ( ( ) => expect ( result . current . isFetching ) . toBe ( false ) ) ;
97
105
98
106
expect ( result . current . data ) . toEqual ( initialData ) ;
99
107
expect ( result . current . error ) . toBeNull ( ) ;
100
-
101
-
102
-
103
108
} ) ;
104
109
105
110
it ( "returns query options that can resolve data correctly with fetchQuery" , async ( ) => {
You can’t perform that action at this time.
0 commit comments