File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed
Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -454,6 +454,7 @@ export type PixIdParams = {
454454export type CreatePixQrCodeResponse =
455455 | {
456456 error : string ;
457+ data : null ;
457458 }
458459 | {
459460 error : null ;
Original file line number Diff line number Diff line change @@ -233,6 +233,24 @@ describe("AbacatePay", () => {
233233 ) ;
234234 expect ( result ) . toEqual ( { data : "pix-qrcode-payment-simulated" } ) ;
235235 } ) ;
236+
237+ it ( "should have simulatePayment method that uses empty object as default metadata" , async ( ) => {
238+ const sdk = AbacatePay ( apiKey ) ;
239+ const pixQrCodeData = { id : "pix_char_abc123" } ;
240+
241+ mockRequest . mockResolvedValue ( { data : "pix-qrcode-payment-simulated" } ) ;
242+
243+ const result = await sdk . pixQrCode . simulatePayment ( pixQrCodeData ) ;
244+
245+ expect ( mockRequest ) . toHaveBeenCalledWith (
246+ "/pixQrCode/simulate-payment?id=pix_char_abc123" ,
247+ {
248+ method : "POST" ,
249+ body : JSON . stringify ( { metadata : { } } ) ,
250+ } ,
251+ ) ;
252+ expect ( result ) . toEqual ( { data : "pix-qrcode-payment-simulated" } ) ;
253+ } ) ;
236254 } ) ;
237255
238256 describe ( "withdrawal" , ( ) => {
You can’t perform that action at this time.
0 commit comments