From 3a9d6efd6dcbb339623912aaa742d751603dd8ae Mon Sep 17 00:00:00 2001 From: volodymyr-basiuk <31999965+volodymyr-basiuk@users.noreply.github.com> Date: Thu, 16 May 2024 14:38:21 +0300 Subject: [PATCH] fix payment integration tests (#233) --- tests/handlers/payment.test.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/handlers/payment.test.ts b/tests/handlers/payment.test.ts index 1159540b..932c375e 100644 --- a/tests/handlers/payment.test.ts +++ b/tests/handlers/payment.test.ts @@ -106,7 +106,7 @@ describe('payment-request handler', () => { if (data.currency !== SupportedCurrencies.ETH) { throw new Error('integration can only pay in eth currency'); } - const options = { value: ethers.formatUnits(data.amount, 'ether') }; + const options = { value: ethers.parseUnits(data.amount, 'ether') }; const txData = await payContract.pay(sessionId, did, options); return txData.hash; }; @@ -117,7 +117,7 @@ describe('payment-request handler', () => { ): Promise => { const rpcProvider = new JsonRpcProvider(RPC_URL); const tx = await rpcProvider.getTransaction(txId); - if (tx?.value !== BigInt(data.amount)) { + if (tx?.value !== ethers.parseUnits(data.amount, 'ether')) { throw new Error('invalid value'); } }; @@ -132,11 +132,11 @@ describe('payment-request handler', () => { type: PaymentRequestType.PaymentRequest, data: { type: PaymentRequestDataType.Iden3PaymentRequestCryptoV1, - amount: '0.1', + amount: '0.001', id: 12432, chainId: 80002, address: '0x2C2007d72f533FfD409F0D9f515983e95bF14992', - currency: 'eth' + currency: 'ETH' }, expiration: '2125558127', description: 'payment-request integration test'