From e029a7265360a1da4f0acbc3ebd9833cd50a36b7 Mon Sep 17 00:00:00 2001 From: MantisClone Date: Mon, 30 Oct 2023 12:55:40 -0400 Subject: [PATCH 1/4] Test cancel after paid --- packages/integration-test/test/node-client.test.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/integration-test/test/node-client.test.ts b/packages/integration-test/test/node-client.test.ts index a4a6fc286a..75546a85aa 100644 --- a/packages/integration-test/test/node-client.test.ts +++ b/packages/integration-test/test/node-client.test.ts @@ -656,7 +656,7 @@ describe('ETH localhost request creation and detection test', () => { payer: payerIdentity, }; - it('can create ETH requests and pay with ETH Fee proxy', async () => { + it('can create ETH requests and pay with ETH Fee proxy and cancel after paid', async () => { const currencies = [...CurrencyManager.getDefaultList()]; const requestNetwork = new RequestNetwork({ signatureProvider, @@ -696,6 +696,10 @@ describe('ETH localhost request creation and detection test', () => { expect(event?.parameters?.feeAddress).toBe('0x0d1d4e623D10F9FBA5Db95830F7d3839406C6AF2'); // amount in crypto after apply the rates of the fake aggregators expect(event?.parameters?.to).toBe('0xc12F17Da12cd01a9CDBB216949BA0b41A6Ffc4EB'); + + // Cancel the request + const cancelData = await request.cancel(payeeIdentity); + expect(data.state).toBe(Types.RequestLogic.STATE.CANCELED); }); it('can create & pay a request with any to eth proxy', async () => { From 33cc6553e87ebd28a5a7d83b81aaa351aadd82a3 Mon Sep 17 00:00:00 2001 From: MantisClone Date: Mon, 30 Oct 2023 13:06:59 -0400 Subject: [PATCH 2/4] fix: wrong data variable --- packages/integration-test/test/node-client.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/integration-test/test/node-client.test.ts b/packages/integration-test/test/node-client.test.ts index 75546a85aa..7b60c2694f 100644 --- a/packages/integration-test/test/node-client.test.ts +++ b/packages/integration-test/test/node-client.test.ts @@ -699,7 +699,7 @@ describe('ETH localhost request creation and detection test', () => { // Cancel the request const cancelData = await request.cancel(payeeIdentity); - expect(data.state).toBe(Types.RequestLogic.STATE.CANCELED); + expect(cancelData.state).toBe(Types.RequestLogic.STATE.CANCELED); }); it('can create & pay a request with any to eth proxy', async () => { From 2dec1016317df2fd9253c222d5cd276bd407bdba Mon Sep 17 00:00:00 2001 From: MantisClone Date: Mon, 30 Oct 2023 13:15:52 -0400 Subject: [PATCH 3/4] fix: wait for confirmation and add debug logging --- packages/integration-test/test/node-client.test.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/integration-test/test/node-client.test.ts b/packages/integration-test/test/node-client.test.ts index 7b60c2694f..00214e9e7b 100644 --- a/packages/integration-test/test/node-client.test.ts +++ b/packages/integration-test/test/node-client.test.ts @@ -698,8 +698,10 @@ describe('ETH localhost request creation and detection test', () => { expect(event?.parameters?.to).toBe('0xc12F17Da12cd01a9CDBB216949BA0b41A6Ffc4EB'); // Cancel the request - const cancelData = await request.cancel(payeeIdentity); - expect(cancelData.state).toBe(Types.RequestLogic.STATE.CANCELED); + const requestDataCancel = await request.cancel(payeeIdentity); + const requestDataCancelConfirmed = await waitForConfirmation(requestDataCancel); + console.log(JSON.stringify(requestDataCancelConfirmed)); + expect(requestDataCancelConfirmed.state).toBe(Types.RequestLogic.STATE.CANCELED); }); it('can create & pay a request with any to eth proxy', async () => { From 0097c24e6d636dd43838ba7ceca77de9e16b7f20 Mon Sep 17 00:00:00 2001 From: MantisClone Date: Mon, 30 Oct 2023 13:30:20 -0400 Subject: [PATCH 4/4] Remove console log. Add check to ensure balance is still 1000 --- packages/integration-test/test/node-client.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/integration-test/test/node-client.test.ts b/packages/integration-test/test/node-client.test.ts index 00214e9e7b..eb231abf4f 100644 --- a/packages/integration-test/test/node-client.test.ts +++ b/packages/integration-test/test/node-client.test.ts @@ -700,8 +700,8 @@ describe('ETH localhost request creation and detection test', () => { // Cancel the request const requestDataCancel = await request.cancel(payeeIdentity); const requestDataCancelConfirmed = await waitForConfirmation(requestDataCancel); - console.log(JSON.stringify(requestDataCancelConfirmed)); expect(requestDataCancelConfirmed.state).toBe(Types.RequestLogic.STATE.CANCELED); + expect(requestDataCancelConfirmed.balance?.balance).toBe('1000'); }); it('can create & pay a request with any to eth proxy', async () => {