Skip to content

Commit

Permalink
Fix all unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
SoraSuegami committed Sep 22, 2024
1 parent 1e94cc1 commit 7ab2036
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 11 deletions.
7 changes: 5 additions & 2 deletions src/EmailRecoveryManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ abstract contract EmailRecoveryManager is
view
returns (uint256)
{
if(!recoveryRequests[account].recoveryDataHashWeight.contains(recoveryDataHash)) {
return 0;
}
return recoveryRequests[account].recoveryDataHashWeight.get(recoveryDataHash);
}

Expand Down Expand Up @@ -487,7 +490,7 @@ abstract contract EmailRecoveryManager is
if (recoveryRequests[msg.sender].executeBefore == 0) {
revert NoRecoveryInProcess();
}
delete recoveryRequests[msg.sender];
clearRecoveryRequest(msg.sender);
emit RecoveryCancelled(msg.sender);
}

Expand All @@ -506,7 +509,7 @@ abstract contract EmailRecoveryManager is
account, block.timestamp, recoveryRequests[account].executeBefore
);
}
delete recoveryRequests[account];
clearRecoveryRequest(account);
emit RecoveryCancelled(account);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -408,9 +408,7 @@ contract OwnableValidatorRecovery_UniversalEmailRecoveryModule_Integration_Test

vm.expectRevert(
abi.encodeWithSelector(
IEmailRecoveryManager.InvalidRecoveryDataHash.selector,
validator2RecoveryDataHash,
recoveryDataHash1
IEmailRecoveryManager.GuardianAlreadyVoted.selector
)
);
// process recovery for validator 2
Expand Down
6 changes: 3 additions & 3 deletions test/unit/EmailRecoveryManager/completeRecovery.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ contract EmailRecoveryManager_completeRecovery_Test is UnitBase {

vm.expectRevert(
abi.encodeWithSelector(
IEmailRecoveryManager.InvalidRecoveryDataHash.selector,
keccak256(invalidRecoveryData),
recoveryDataHash
IEmailRecoveryManager.NotEnoughApprovals.selector,
0,
3
)
);
emailRecoveryModule.completeRecovery(accountAddress1, invalidRecoveryData);
Expand Down
4 changes: 1 addition & 3 deletions test/unit/EmailRecoveryManager/processRecovery.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,7 @@ contract EmailRecoveryManager_processRecovery_Test is UnitBase {

vm.expectRevert(
abi.encodeWithSelector(
IEmailRecoveryManager.InvalidRecoveryDataHash.selector,
invalidRecoveryDataHash,
recoveryDataHash
IEmailRecoveryManager.GuardianAlreadyVoted.selector
)
);
emailRecoveryModule.exposed_processRecovery(
Expand Down

0 comments on commit 7ab2036

Please sign in to comment.