Updated deposit scenarios

This commit is contained in:
emilio 2020-08-13 14:32:41 +02:00
parent 3c3e4d146a
commit 547c95dc1a
2 changed files with 49 additions and 42 deletions

View File

@ -127,32 +127,64 @@
] ]
}, },
{ {
"description": "User 0 deposits 1 ETH in an empty reserve", "description": "User 0 deposits 1 WETH in an empty reserve",
"actions": [ "actions": [
{
"name": "mint",
"args": {
"reserve": "WETH",
"amount": "1",
"user": "0"
},
"expected": "success"
},
{
"name": "approve",
"args": {
"reserve": "WETH",
"user": "0"
},
"expected": "success"
},
{ {
"name": "deposit", "name": "deposit",
"args": { "args": {
"reserve": "WETH", "reserve": "WETH",
"amount": "1", "amount": "1",
"user": "0", "user": "0"
"sendValue": "1"
}, },
"expected": "success" "expected": "success"
} }
] ]
}, },
{ {
"description": "User 1 deposits 1 ETH after user 0", "description": "User 1 deposits 1 WETH after user 0",
"actions": [ "actions": [
{
"name": "mint",
"args": {
"reserve": "WETH",
"amount": "1",
"user": "1"
},
"expected": "success"
},
{
"name": "approve",
"args": {
"reserve": "WETH",
"user": "1"
},
"expected": "success"
},
{ {
"name": "deposit", "name": "deposit",
"args": { "args": {
"reserve": "WETH", "reserve": "WETH",
"amount": "1", "amount": "1",
"user": "1", "user": "1"
"sendValue": "1"
}, },
"expected": "success" "expected": "success"
} }
@ -161,6 +193,15 @@
{ {
"description": "User 1 deposits 0 ETH (revert expected)", "description": "User 1 deposits 0 ETH (revert expected)",
"actions": [ "actions": [
{
"name": "mint",
"args": {
"reserve": "WETH",
"amount": "1",
"user": "0"
},
"expected": "success"
},
{ {
"name": "deposit", "name": "deposit",
"args": { "args": {
@ -188,40 +229,6 @@
"revertMessage": "Amount must be greater than 0" "revertMessage": "Amount must be greater than 0"
} }
] ]
},
{
"description": "User 1 tries to deposit ETH without sending any value",
"actions": [
{
"name": "deposit",
"args": {
"reserve": "WETH",
"amount": "1",
"user": "1",
"sendValue": "0"
},
"expected": "revert",
"revertMessage": "The amount and the value sent to deposit do not match"
}
]
},
{
"description": "User 1 tries to deposit ETH by sending less value than required",
"actions": [
{
"name": "deposit",
"args": {
"reserve": "WETH",
"amount": "1",
"user": "1",
"sendValue": "0.5"
},
"expected": "revert",
"revertMessage": "The amount and the value sent to deposit do not match"
}
]
} }
] ]
} }

View File

@ -12,7 +12,7 @@ BigNumber.config({DECIMAL_PLACES: 0, ROUNDING_MODE: BigNumber.ROUND_DOWN});
const scenarioFolder = './test/helpers/scenarios/'; const scenarioFolder = './test/helpers/scenarios/';
const selectedScenarios: string[] = []; const selectedScenarios: string[] = ['deposit.json'];
fs.readdirSync(scenarioFolder).forEach((file) => { fs.readdirSync(scenarioFolder).forEach((file) => {
if (selectedScenarios.length > 0 && !selectedScenarios.includes(file)) return; if (selectedScenarios.length > 0 && !selectedScenarios.includes(file)) return;