Open benjaminbollen opened 5 years ago
Following things can be covered in this epic:
brandedtoken-contracts
)mosaic-contracts
, openst-contracts
and brandedtoken-contracts
)mosaic-contracts
, openst-contracts
and brandedtoken-contracts
, JLP
)There can be a config file that can store the default decimal value. While running the tests the decimal value can be provided. All the tests can read the value from this config file. In this way, we can get the flexibility to run the tests with variations. CI can be enabled to run the nightly builds for all the variations. In the future, this config file can have more such variables.
Following is the proposal (We can discuss this and modify)
Update test code to read decimals from a config file instead of hardcoded value.
One of the proposals for the config file
is as shown below. This config file reads the value from env variable, if its not there then it fallbacks to 18 by default.
{
DECIMALS: process.env.DECIMALS || 18
};
Add a new script command in package.json
that accepts the range for the decimals and executes the test for all the decimals in the range. If a single value is provided then the tests run for that given decimal.
Example of the script
#!/bin/bash
# Do validations here
for (( i=$1; i<=$2; i++ ))
do
echo $i
export DECIMALS=$i
npm run test
done
Example of the package.json script
{
"scripts": {
"test:range": "./test.sh",
"test": "node ./Test.ts $*"
}
}
We can execute this as follows
npm run test:range 1 24
In this way we can get the capability to do the unit tests with variations.
Both in Mosaic and OpenST, assert and expand the test suite to cover for arbitrary decimals in the EIP20 token contracts