Skip to content

Commit 583e6ee

Browse files
committed
add batch proxy addresses and clean tests
1 parent 6de03f6 commit 583e6ee

File tree

1 file changed

+12
-21
lines changed

1 file changed

+12
-21
lines changed

packages/payment-processor/test/payment/any-to-erc20-batch-proxy.test.ts

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,6 @@ describe('erc20-batch-conversion-proxy', () => {
245245
],
246246
batchConvVersion,
247247
wallet,
248-
true,
249248
),
250249
).rejects.toThrowError(
251250
new UnsupportedCurrencyError({
@@ -266,14 +265,13 @@ describe('erc20-batch-conversion-proxy', () => {
266265
],
267266
batchConvVersion,
268267
wallet,
269-
true,
270268
),
271269
).rejects.toThrowError('the enrichedRequest has no paymentSettings');
272270
});
273271
it('should throw an error if the request is ETH', async () => {
274272
EURRequest.currencyInfo.type = RequestLogicTypes.CURRENCY.ETH;
275273
await expect(
276-
payBatchConversionProxyRequest(enrichedRequests, batchConvVersion, wallet, true),
274+
payBatchConversionProxyRequest(enrichedRequests, batchConvVersion, wallet),
277275
).rejects.toThrowError(`wrong request currencyInfo type`);
278276
});
279277
it('should throw an error if the request has a wrong network', async () => {
@@ -295,7 +293,7 @@ describe('erc20-batch-conversion-proxy', () => {
295293
};
296294

297295
await expect(
298-
payBatchConversionProxyRequest(enrichedRequests, batchConvVersion, wallet, true),
296+
payBatchConversionProxyRequest(enrichedRequests, batchConvVersion, wallet),
299297
).rejects.toThrowError('All the requests must have the same network');
300298
});
301299
it('should throw an error if the request has a wrong payment network id', async () => {
@@ -316,21 +314,21 @@ describe('erc20-batch-conversion-proxy', () => {
316314
};
317315

318316
await expect(
319-
payBatchConversionProxyRequest(enrichedRequests, batchConvVersion, wallet, true),
317+
payBatchConversionProxyRequest(enrichedRequests, batchConvVersion, wallet),
320318
).rejects.toThrowError(
321319
'request cannot be processed, or is not an pn-any-to-erc20-proxy request',
322320
);
323321
});
324322
it("should throw an error if one request's currencyInfo has no value", async () => {
325323
EURRequest.currencyInfo.value = '';
326324
await expect(
327-
payBatchConversionProxyRequest(enrichedRequests, batchConvVersion, wallet, true),
325+
payBatchConversionProxyRequest(enrichedRequests, batchConvVersion, wallet),
328326
).rejects.toThrowError("The currency '' is unknown or not supported");
329327
});
330328
it('should throw an error if request has no extension', async () => {
331329
EURRequest.extensions = [] as any;
332330
await expect(
333-
payBatchConversionProxyRequest(enrichedRequests, batchConvVersion, wallet, true),
331+
payBatchConversionProxyRequest(enrichedRequests, batchConvVersion, wallet),
334332
).rejects.toThrowError('no payment network found');
335333
});
336334
it('should throw an error if there is a wrong version mapping', async () => {
@@ -341,7 +339,7 @@ describe('erc20-batch-conversion-proxy', () => {
341339
},
342340
};
343341
await expect(
344-
payBatchConversionProxyRequest(enrichedRequests, batchConvVersion, wallet, true),
342+
payBatchConversionProxyRequest(enrichedRequests, batchConvVersion, wallet),
345343
).rejects.toThrowError('Every payment network type and version must be identical');
346344
});
347345
});
@@ -447,7 +445,6 @@ describe('erc20-batch-conversion-proxy', () => {
447445
}),
448446
batchConvVersion,
449447
wallet,
450-
true,
451448
);
452449
const confirmedTx = await tx.wait(1);
453450
expect(confirmedTx.status).toEqual(1);
@@ -503,7 +500,6 @@ describe('erc20-batch-conversion-proxy', () => {
503500
],
504501
batchConvVersion,
505502
wallet,
506-
true,
507503
);
508504
const confirmedTx = await tx.wait(1);
509505
expect(confirmedTx.status).toEqual(1);
@@ -557,14 +553,14 @@ describe('erc20-batch-conversion-proxy', () => {
557553
it('should throw an error if the request is not erc20', async () => {
558554
FAURequest.currencyInfo.type = RequestLogicTypes.CURRENCY.ETH;
559555
await expect(
560-
payBatchConversionProxyRequest(enrichedRequests, batchConvVersion, wallet, true),
556+
payBatchConversionProxyRequest(enrichedRequests, batchConvVersion, wallet),
561557
).rejects.toThrowError('wrong request currencyInfo type');
562558
});
563559

564560
it("should throw an error if one request's currencyInfo has no value", async () => {
565561
FAURequest.currencyInfo.value = '';
566562
await expect(
567-
payBatchConversionProxyRequest(enrichedRequests, batchConvVersion, wallet, true),
563+
payBatchConversionProxyRequest(enrichedRequests, batchConvVersion, wallet),
568564
).rejects.toThrowError(
569565
'request cannot be processed, or is not an pn-erc20-fee-proxy-contract request',
570566
);
@@ -573,7 +569,7 @@ describe('erc20-batch-conversion-proxy', () => {
573569
it("should throw an error if one request's currencyInfo has no network", async () => {
574570
FAURequest.currencyInfo.network = '';
575571
await expect(
576-
payBatchConversionProxyRequest(enrichedRequests, batchConvVersion, wallet, true),
572+
payBatchConversionProxyRequest(enrichedRequests, batchConvVersion, wallet),
577573
).rejects.toThrowError(
578574
'request cannot be processed, or is not an pn-erc20-fee-proxy-contract request',
579575
);
@@ -582,7 +578,7 @@ describe('erc20-batch-conversion-proxy', () => {
582578
it('should throw an error if request has no extension', async () => {
583579
FAURequest.extensions = [] as any;
584580
await expect(
585-
payBatchConversionProxyRequest(enrichedRequests, batchConvVersion, wallet, true),
581+
payBatchConversionProxyRequest(enrichedRequests, batchConvVersion, wallet),
586582
).rejects.toThrowError('no payment network found');
587583
});
588584

@@ -594,7 +590,7 @@ describe('erc20-batch-conversion-proxy', () => {
594590
},
595591
};
596592
await expect(
597-
payBatchConversionProxyRequest(enrichedRequests, batchConvVersion, wallet, true),
593+
payBatchConversionProxyRequest(enrichedRequests, batchConvVersion, wallet),
598594
).rejects.toThrowError('Every payment network type and version must be identical');
599595
});
600596
});
@@ -650,12 +646,7 @@ describe('erc20-batch-conversion-proxy', () => {
650646
const initialFAUFeeBalance = await getErc20Balance(FAUValidRequest, feeAddress, provider);
651647

652648
// Batch payment
653-
const tx = await payBatchConversionProxyRequest(
654-
enrichedRequests,
655-
batchConvVersion,
656-
wallet,
657-
true,
658-
);
649+
const tx = await payBatchConversionProxyRequest(enrichedRequests, batchConvVersion, wallet);
659650
const confirmedTx = await tx.wait(1);
660651
expect(confirmedTx.status).toBe(1);
661652
expect(tx.hash).not.toBeUndefined();

0 commit comments

Comments
 (0)