@@ -1281,8 +1281,11 @@ describe('Qraft uses Mutations', () => {
12811281 mutateWithEmptyBody,
12821282 } = result . current ;
12831283
1284- expect ( mutateNoArgsWithVoidParameters . data ) . toBeUndefined ( ) ;
1284+ expect ( mutateNoArgsWithVoidParameters . isSuccess ) . toBeTruthy ( ) ;
1285+ expect ( mutateNoArgsWithVoidParameters . data ) . toEqual ( { } ) ;
1286+ expect ( mutateNoArgsWithEmptyParameters . isSuccess ) . toBeTruthy ( ) ;
12851287 expect ( mutateNoArgsWithEmptyParameters . data ) . toEqual ( { } ) ;
1288+ expect ( mutateWithPredefinedParameters . isSuccess ) . toBeTruthy ( ) ;
12861289 expect ( mutateWithPredefinedParameters . data ) . toEqual ( {
12871290 query : { all : 'true' } ,
12881291 } ) ;
@@ -1913,6 +1916,40 @@ describe('Qraft uses getMutationCache', () => {
19131916 } ) ;
19141917 } ) ;
19151918
1919+ it ( 'supports getMutationCache().find() with status success and useMutation options mutationKey' , async ( ) => {
1920+ const { qraft, queryClient } = createClient ( ) ;
1921+ const mutationKey = qraft . files . deleteFiles . getMutationKey ( ) ;
1922+
1923+ const { result : mutationResult } = renderHook (
1924+ ( ) =>
1925+ qraft . files . deleteFiles . useMutation ( undefined , {
1926+ gcTime : Infinity ,
1927+ mutationKey,
1928+ } ) ,
1929+ {
1930+ wrapper : ( props ) => (
1931+ < Providers { ...props } queryClient = { queryClient } />
1932+ ) ,
1933+ }
1934+ ) ;
1935+
1936+ act ( ( ) => {
1937+ mutationResult . current . mutate ( ) ;
1938+ } ) ;
1939+
1940+ await waitFor ( ( ) => {
1941+ expect ( mutationResult . current . status ) . toEqual ( 'success' ) ;
1942+ } ) ;
1943+
1944+ const foundMutation = queryClient . getMutationCache ( ) . find ( {
1945+ mutationKey,
1946+ status : 'success' ,
1947+ } ) ;
1948+
1949+ expect ( foundMutation ) . toBeDefined ( ) ;
1950+ expect ( foundMutation ?. state . status ) . toEqual ( 'success' ) ;
1951+ } ) ;
1952+
19161953 it ( 'supports getMutationCache().find() with partial not exact parameters' , async ( ) => {
19171954 const { qraft, queryClient } = createClient ( ) ;
19181955
0 commit comments