Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
Admin committed Nov 29, 2024
1 parent 824abca commit 405cf29
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
10 changes: 3 additions & 7 deletions script/Setup.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,15 @@ contract SetupScript is Script {

// 1. Setup UserProfile
UserProfile userProfileContract = UserProfile(userProfile);

// Create deployer's profile
userProfileContract.createProfile(
"Deployer",
"A sample deployer bio",
"IPFS://profile-metadata"
);
userProfileContract.createProfile("Deployer", "A sample deployer bio", "IPFS://profile-metadata");
console2.log("Created profile for deployer:", deployer);

// Grant roles
bytes32 reputationManagerRole = userProfileContract.REPUTATION_MANAGER_ROLE();
bytes32 verifierRole = userProfileContract.VERIFIER_ROLE();

userProfileContract.grantRole(reputationManagerRole, deployer);
userProfileContract.grantRole(verifierRole, deployer);
console2.log("Granted reputation manager and verifier roles to deployer");
Expand Down
14 changes: 7 additions & 7 deletions test/UserProfile.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -235,23 +235,23 @@ contract UserProfileTest is Test {
function test_DeployerRoleSetup() public {
address deployer = makeAddr("deployer");
vm.startPrank(deployer);

// Create a new UserProfile contract with deployer as the sender
UserProfile newProfile = new UserProfile();

// Check that deployer has all roles
assertTrue(newProfile.hasRole(newProfile.DEFAULT_ADMIN_ROLE(), deployer));
assertTrue(newProfile.hasRole(newProfile.REPUTATION_MANAGER_ROLE(), deployer));
assertTrue(newProfile.hasRole(newProfile.VERIFIER_ROLE(), deployer));

vm.stopPrank();
}

function test_CompleteVerificationFlow() public {
// Create profile
vm.startPrank(user1);
userProfile.createProfile("alice", "Web3 developer", "ipfs://metadata1");

// Set recovery address
address recoveryAddr = makeAddr("recovery");
userProfile.setRecoveryAddress(recoveryAddr);
Expand All @@ -277,17 +277,17 @@ contract UserProfileTest is Test {
userProfile.createProfile("alice", "Web3 developer", "ipfs://metadata1");

vm.startPrank(reputationManager);

// Test maximum reputation
userProfile.updateReputation(user1, 1000);
UserProfile.Profile memory profile = userProfile.getProfile(user1);
assertEq(profile.reputationScore, 1000);

// Test minimum reputation
userProfile.updateReputation(user1, 0);
profile = userProfile.getProfile(user1);
assertEq(profile.reputationScore, 0);

vm.stopPrank();
}

Expand Down

0 comments on commit 405cf29

Please sign in to comment.