From d7656839fa9a4d9228f8520d5943a07dfb2ad074 Mon Sep 17 00:00:00 2001 From: emilio Date: Mon, 17 Aug 2020 13:48:23 +0200 Subject: [PATCH] Fixes remaining tests --- test/helpers/scenarios/borrow-negatives.json | 3 +- .../scenarios/borrow-repay-stable.json | 3 +- .../scenarios/borrow-repay-variable.json | 14 ++--- .../scenarios/interest-redirection.json | 20 ++++++- .../scenarios/rebalance-stable-rate.json | 60 +++++++++++++++++-- test/helpers/scenarios/redeem-negatives.json | 3 +- test/helpers/scenarios/swap-rate-mode.json | 20 ++++++- test/scenario.spec.ts | 2 +- 8 files changed, 99 insertions(+), 26 deletions(-) diff --git a/test/helpers/scenarios/borrow-negatives.json b/test/helpers/scenarios/borrow-negatives.json index f665f2d7..6a8ceb66 100644 --- a/test/helpers/scenarios/borrow-negatives.json +++ b/test/helpers/scenarios/borrow-negatives.json @@ -123,8 +123,7 @@ "reserve": "WETH", "amount": "1", - "user": "1", - "sendValue": "1" + "user": "1" }, "expected": "success" }, diff --git a/test/helpers/scenarios/borrow-repay-stable.json b/test/helpers/scenarios/borrow-repay-stable.json index 33a1a2b0..f63bd2bd 100644 --- a/test/helpers/scenarios/borrow-repay-stable.json +++ b/test/helpers/scenarios/borrow-repay-stable.json @@ -54,8 +54,7 @@ "reserve": "WETH", "amount": "1", - "user": "1", - "sendValue": "1" + "user": "1" }, "expected": "success" }, diff --git a/test/helpers/scenarios/borrow-repay-variable.json b/test/helpers/scenarios/borrow-repay-variable.json index 35b44e33..1ae42ea0 100644 --- a/test/helpers/scenarios/borrow-repay-variable.json +++ b/test/helpers/scenarios/borrow-repay-variable.json @@ -220,7 +220,7 @@ "name": "mint", "args": { "reserve": "WETH", - "amount": "1", + "amount": "0.001", "user": "2" }, "expected": "success" @@ -239,8 +239,7 @@ "reserve": "WETH", "amount": "0.001", - "user": "2", - "sendValue": "0.001" + "user": "2" }, "expected": "success" } @@ -327,8 +326,7 @@ "amount": "0", "user": "1", "onBehalfOf": "1", - "borrowRateMode": "variable", - "sendValue": "0" + "borrowRateMode": "variable" }, "expected": "revert", "revertMessage": "Amount must be greater than 0" @@ -797,8 +795,7 @@ "reserve": "WETH", "amount": "0.1", - "user": "3", - "sendValue": "0.1" + "user": "3" }, "expected": "success" }, @@ -882,8 +879,7 @@ "reserve": "WETH", "amount": "2", - "user": "6", - "sendValue": "2" + "user": "6" }, "expected": "success" }, diff --git a/test/helpers/scenarios/interest-redirection.json b/test/helpers/scenarios/interest-redirection.json index b95ee64e..a89199bf 100644 --- a/test/helpers/scenarios/interest-redirection.json +++ b/test/helpers/scenarios/interest-redirection.json @@ -45,14 +45,30 @@ { "description": "User 1 deposits 1 ETH, borrows 100 DAI, repays after one year. Users 0 deposits another 1000 DAI. Redirected balance of user 2 is updated", "actions": [ + { + "name": "mint", + "args": { + "reserve": "WETH", + "amount": "2", + "user": "1" + }, + "expected": "success" + }, + { + "name": "approve", + "args": { + "reserve": "WETH", + "user": "1" + }, + "expected": "success" + }, { "name": "deposit", "args": { "reserve": "WETH", "amount": "2", - "user": "1", - "sendValue": "2" + "user": "1" }, "expected": "success" }, diff --git a/test/helpers/scenarios/rebalance-stable-rate.json b/test/helpers/scenarios/rebalance-stable-rate.json index b76a169d..1200ff3e 100644 --- a/test/helpers/scenarios/rebalance-stable-rate.json +++ b/test/helpers/scenarios/rebalance-stable-rate.json @@ -47,14 +47,30 @@ }, "expected": "success" }, + { + "name": "mint", + "args": { + "reserve": "WETH", + "amount": "1", + "user": "1" + }, + "expected": "success" + }, + { + "name": "approve", + "args": { + "reserve": "WETH", + "user": "1" + }, + "expected": "success" + }, { "name": "deposit", "args": { "reserve": "WETH", "amount": "1", - "user": "1", - "sendValue": "1" + "user": "1" }, "expected": "success" }, @@ -108,14 +124,30 @@ { "description": "User 2 deposits ETH and borrows the remaining DAI, causing the stable rates to rise (liquidity rate < user 1 borrow rate). User 0 tries to rebalance user 1 (revert expected)", "actions": [ + { + "name": "mint", + "args": { + "reserve": "WETH", + "amount": "5", + "user": "2" + }, + "expected": "success" + }, + { + "name": "approve", + "args": { + "reserve": "WETH", + "user": "2" + }, + "expected": "success" + }, { "name": "deposit", "args": { "reserve": "WETH", "amount": "5", - "user": "2", - "sendValue": "5" + "user": "2" }, "expected": "success" }, @@ -144,14 +176,30 @@ { "description": "User 2 borrows more DAI, causing the liquidity rate to rise above user 1 stable borrow rate User 0 rebalances user 1", "actions": [ + { + "name": "mint", + "args": { + "reserve": "WETH", + "amount": "3", + "user": "2" + }, + "expected": "success" + }, + { + "name": "approve", + "args": { + "reserve": "WETH", + "user": "2" + }, + "expected": "success" + }, { "name": "deposit", "args": { "reserve": "WETH", "amount": "3", - "user": "2", - "sendValue": "3" + "user": "2" }, "expected": "success" }, diff --git a/test/helpers/scenarios/redeem-negatives.json b/test/helpers/scenarios/redeem-negatives.json index 12ce083b..982a41a1 100644 --- a/test/helpers/scenarios/redeem-negatives.json +++ b/test/helpers/scenarios/redeem-negatives.json @@ -85,8 +85,7 @@ "reserve": "WETH", "amount": "1", - "user": "1", - "sendValue": "1" + "user": "1" }, "expected": "success" }, diff --git a/test/helpers/scenarios/swap-rate-mode.json b/test/helpers/scenarios/swap-rate-mode.json index af202567..e2612586 100644 --- a/test/helpers/scenarios/swap-rate-mode.json +++ b/test/helpers/scenarios/swap-rate-mode.json @@ -61,14 +61,30 @@ }, "expected": "success" }, + { + "name": "mint", + "args": { + "reserve": "WETH", + "amount": "2", + "user": "1" + }, + "expected": "success" + }, + { + "name": "approve", + "args": { + "reserve": "WETH", + "user": "1" + }, + "expected": "success" + }, { "name": "deposit", "args": { "reserve": "WETH", "amount": "2", - "user": "1", - "sendValue": "2" + "user": "1" }, "expected": "success" }, diff --git a/test/scenario.spec.ts b/test/scenario.spec.ts index 8278c58a..5d449d76 100644 --- a/test/scenario.spec.ts +++ b/test/scenario.spec.ts @@ -12,7 +12,7 @@ BigNumber.config({DECIMAL_PLACES: 0, ROUNDING_MODE: BigNumber.ROUND_DOWN}); const scenarioFolder = './test/helpers/scenarios/'; -const selectedScenarios: string[] = ['set-use-as-collateral.json']; +const selectedScenarios: string[] = []; fs.readdirSync(scenarioFolder).forEach((file) => { if (selectedScenarios.length > 0 && !selectedScenarios.includes(file)) return;