Test Cases
Role Management
-
Test Admin Role:
-
Test Provider Role:
Minting Functionality
-
Test Minting Conditions:
-
Test Token ID Mapping:
Token Issuance
Score Management
-
Test getScore Function:
-
Test addScores Function:
Test Structure
To follow a standard testing process and accommodate upgradable contracts and role changes, we break down the test cases into sub-descriptions (Success and Revert) and start all test cases with Should.
This structure ensures comprehensive test coverage for the upgradable contract and role functionalities, including minting, issuing tokens, and score management.
Test Cases
Role Management
Test Admin Role:
DEFAULT_ADMIN_ROLEcan grant roles.DEFAULT_ADMIN_ROLEcan revoke roles.DEFAULT_ADMIN_ROLEhas the ability to manage roles.DEFAULT_ADMIN_ROLEcannot transfer ownership unintentionally.Test Provider Role:
PROVIDER_ROLEcan call theaddScores(date, ids, cids)andgetScorefunctions.PROVIDER_ROLEcan update IPFS data for community tokens and user scores.PROVIDER_ROLEcannot grant or revoke roles.PROVIDER_ROLEcannot be granted or revoked by anyone other than theDEFAULT_ADMIN_ROLE.Minting Functionality
Test Minting Conditions:
tokenBalance[tokenId]is set to +1 after minting.Test Token ID Mapping:
Token Issuance
Score Management
Test
getScoreFunction:getScorefunction is public and can be called by anyone.Test
addScoresFunction:PROVIDER_ROLEcan call theaddScores(date, ids, cids)function.Test Structure
To follow a standard testing process and accommodate upgradable contracts and role changes, we break down the test cases into sub-descriptions (
SuccessandRevert) and start all test cases withShould.This structure ensures comprehensive test coverage for the upgradable contract and role functionalities, including minting, issuing tokens, and score management.