@@ -9,7 +9,7 @@ import { createAPIClient } from './fixtures/queryable-write-operations-api/index
99const baseUrl = 'https://api.sandbox.monite.com/v1' ;
1010
1111describe ( 'Queryable write operations' , ( ) => {
12- it ( 'queries writable operations with a specific body' , async ( ) => {
12+ it ( 'queries writable operations with a specific body for useQuery ' , async ( ) => {
1313 const queryClient = new QueryClient ( ) ;
1414 const qraft = createAPIClient ( {
1515 requestFn,
@@ -48,6 +48,85 @@ describe('Queryable write operations', () => {
4848 } ) ;
4949 } ) ;
5050
51+ it ( 'queries writable operations with a specific body for fetchQuery' , async ( ) => {
52+ const queryClient = new QueryClient ( ) ;
53+ const qraft = createAPIClient ( {
54+ requestFn,
55+ baseUrl,
56+ queryClient,
57+ } ) ;
58+
59+ const result =
60+ await qraft . approvalPolicies . patchApprovalPoliciesId . fetchQuery ( {
61+ parameters : {
62+ header : {
63+ 'x-monite-version' : '1' ,
64+ 'x-monite-entity-id' : '2' ,
65+ } ,
66+ path : {
67+ approval_policy_id : '2' ,
68+ } ,
69+ body : {
70+ name : 'New Name' ,
71+ description : 'New Description' ,
72+ } ,
73+ } ,
74+ } ) ;
75+
76+ await waitFor ( ( ) => {
77+ expect ( result ) . toEqual ( {
78+ id : '2' ,
79+ name : 'New Name' ,
80+ description : 'New Description' ,
81+ } ) ;
82+ } ) ;
83+ } ) ;
84+
85+ it ( 'queries writable operations with a specific body for fetchInfiniteQuery' , async ( ) => {
86+ const queryClient = new QueryClient ( ) ;
87+ const qraft = createAPIClient ( {
88+ requestFn,
89+ baseUrl,
90+ queryClient,
91+ } ) ;
92+
93+ const result =
94+ await qraft . approvalPolicies . patchApprovalPoliciesId . fetchInfiniteQuery ( {
95+ parameters : {
96+ header : {
97+ 'x-monite-version' : '1' ,
98+ 'x-monite-entity-id' : '2' ,
99+ } ,
100+ path : {
101+ approval_policy_id : '2' ,
102+ } ,
103+ body : {
104+ name : 'New Name' ,
105+ description : 'New Description' ,
106+ } ,
107+ } ,
108+ initialPageParam : {
109+ body : {
110+ trigger : true ,
111+ } ,
112+ } ,
113+ } ) ;
114+
115+ await waitFor ( ( ) => {
116+ expect ( result ) . toEqual ( {
117+ pageParams : [ { body : { trigger : true } } ] ,
118+ pages : [
119+ {
120+ id : '2' ,
121+ name : 'New Name' ,
122+ description : 'New Description' ,
123+ trigger : true ,
124+ } ,
125+ ] ,
126+ } ) ;
127+ } ) ;
128+ } ) ;
129+
51130 it ( 'queries writable operations without body' , async ( ) => {
52131 const queryClient = new QueryClient ( ) ;
53132 const qraft = createAPIClient ( {
0 commit comments