Skip to content

Commit

Permalink
Added unit tests for Router contract
Browse files Browse the repository at this point in the history
  • Loading branch information
sweep-ai[bot] committed Aug 22, 2023
1 parent 8103f1e commit f05b99f
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions test/RouterTest.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
pragma solidity ^0.8.20;

import "truffle/Assert.sol";
import "truffle/DeployedAddresses.sol";
import "../contracts/Router.sol";
import "../contracts/lib/MultiSendCallOnly.sol";

contract RouterTest {
Router router = Router(DeployedAddresses.Router());

function testOwnerCanCall() public {
bool r = router.updatePluginLogic(DeployedAddresses.Router());
Assert.equal(r, true, "Owner should be able to call");
}

function testNonOwnerCannotCall() public {
(bool r, ) = address(router).call(abi.encodePacked(router.updatePluginLogic.selector, DeployedAddresses.Router()));
Assert.equal(r, false, "Non-owner should not be able to call");
}

function testMultiSendWithLargeTransactionBundles() public {
bytes memory transactions = new bytes(10000);
bool r = router.multiSend(transactions);
Assert.equal(r, true, "Should be able to handle large transaction bundles");
}
}

0 comments on commit f05b99f

Please sign in to comment.