From 7ed99be77d5bc94f5b194416c86c918b68f3ff11 Mon Sep 17 00:00:00 2001 From: Rahul Sethuram Date: Sat, 19 Sep 2020 14:16:00 +0200 Subject: [PATCH] Collateral target integration test --- modules/test-runner/src/collateral/request.test.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/modules/test-runner/src/collateral/request.test.ts b/modules/test-runner/src/collateral/request.test.ts index 7ac14ca135..cb31e3d71a 100644 --- a/modules/test-runner/src/collateral/request.test.ts +++ b/modules/test-runner/src/collateral/request.test.ts @@ -62,6 +62,19 @@ describe(name, () => { expect(freeBalance[nodeSignerAddress]).to.be.least(requestedTarget); }); + it("should collateralize tokens with a target lower than profile", async () => { + const requestedTarget = utils.parseEther("10"); // requested < 20 + const response = (await client.requestCollateral(tokenAddress, requestedTarget))!; + expect(response).to.be.ok; + expect(response.completed).to.be.ok; + expect(response.transaction).to.be.ok; + expect(response.transaction.hash).to.be.ok; + expect(response.depositAppIdentityHash).to.be.ok; + const { freeBalance } = await response.completed(); + expect(freeBalance[client.signerAddress]).to.be.eq(Zero); + expect(freeBalance[nodeSignerAddress]).to.be.eq(requestedTarget); + }); + it("should properly handle concurrent collateral requests", async () => { const appDef = client.config.contractAddresses[client.chainId].DepositApp; let depositAppCount = 0;