Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Filipp Makarov authored and Filipp Makarov committed Nov 1, 2024
1 parent 4136703 commit bbe68ea
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
8 changes: 8 additions & 0 deletions test/foundry/unit/concrete/modules/TestK1Validator.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,14 @@ contract TestK1Validator is NexusTest_Base {
assertTrue(validator.isSafeSender(address(0x02), address(0x03)));
}

/// @notice Tests the isSafeSender function to check if a sender is in the safe senders list
function test_isSafeSender_Success() public {
assertFalse(validator.isSafeSender(address(0x01), address(0x03)));
prank(address(0x03));
validator.addSafeSender(address(0x01));
assertTrue(validator.isSafeSender(address(0x01), address(0x03)));
}

/// @notice Generates an ERC-1271 hash for personal sign
/// @param childHash The child hash
/// @return The ERC-1271 hash for personal sign
Expand Down
11 changes: 10 additions & 1 deletion test/foundry/unit/concrete/modules/TestK1Validator.tree
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ TestK1Validator
├── when testing the validateUserOp function
│ ├── it should succeed with a valid signature (toEthSignedMessageHash)
│ └── it should fail with an invalid signature
│ └── signature malleability should be rejected because of nonce
├── when testing the isValidSignatureWithSender function
│ ├── it should succeed with a valid signature
│ └── it should fail with an invalid signature
│ └── it should succeed with a valid signature for isValidSignatureWithSender
│ └── it should fail with an invalid 's' value for isValidSignatureWithSender
│ └── it should fail with an inverted 's' value for isValidSignatureWithSender
├── when testing the transferOwnership function
│ ├── it should transfer ownership to a new address
│ └── it should revert when transferring to the zero address
Expand All @@ -27,3 +28,11 @@ TestK1Validator
└── when testing the isModuleType function
├── it should return true for VALIDATOR module type
└── it should return false for an invalid module type
├── when testing the addSafeSender function
│ └── it should add a safe sender to the safe senders list
├── when testing the removeSafeSender function
│ └── it should remove a safe sender from the safe senders list
├── when testing the fillSafeSenders function
│ └── it should fill the safe senders list
├── when testing the isSafeSender function
│ └── it should check if a sender is in the safe senders list

0 comments on commit bbe68ea

Please sign in to comment.