Skip to content

Commit 4d58ddf

Browse files
fix payment integration tests
1 parent 83fae42 commit 4d58ddf

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tests/handlers/payment.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ describe('payment-request handler', () => {
106106
if (data.currency !== SupportedCurrencies.ETH) {
107107
throw new Error('integration can only pay in eth currency');
108108
}
109-
const options = { value: ethers.formatUnits(data.amount, 'ether') };
109+
const options = { value: ethers.parseUnits(data.amount, 'ether') };
110110
const txData = await payContract.pay(sessionId, did, options);
111111
return txData.hash;
112112
};
@@ -117,7 +117,7 @@ describe('payment-request handler', () => {
117117
): Promise<void> => {
118118
const rpcProvider = new JsonRpcProvider(RPC_URL);
119119
const tx = await rpcProvider.getTransaction(txId);
120-
if (tx?.value !== BigInt(data.amount)) {
120+
if (tx?.value !== ethers.parseUnits(data.amount, 'ether')) {
121121
throw new Error('invalid value');
122122
}
123123
};
@@ -132,11 +132,11 @@ describe('payment-request handler', () => {
132132
type: PaymentRequestType.PaymentRequest,
133133
data: {
134134
type: PaymentRequestDataType.Iden3PaymentRequestCryptoV1,
135-
amount: '0.1',
135+
amount: '0.001',
136136
id: 12432,
137137
chainId: 80002,
138138
address: '0x2C2007d72f533FfD409F0D9f515983e95bF14992',
139-
currency: 'eth'
139+
currency: 'ETH'
140140
},
141141
expiration: '2125558127',
142142
description: 'payment-request integration test'

0 commit comments

Comments
 (0)