Skip to content

Commit

Permalink
Only run safe integration tests if account type is safe
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnGuilding committed Jul 2, 2024
1 parent 6f8345b commit c1efbbb
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
15 changes: 15 additions & 0 deletions test/integration/SafeRecovery/SafeIntegrationBase.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,22 @@ abstract contract SafeIntegrationBase is IntegrationBase {

uint256 nullifierCount;

/**
* Helper function to return if current account type is safe or not
*/
function isAccountTypeSafe() public returns (bool) {
string memory currentAccountType = vm.envOr("ACCOUNT_TYPE", string(""));
if (Strings.equal(currentAccountType, "SAFE")) {
return true;
} else {
return false;
}
}

function setUp() public virtual override {
if (!isAccountTypeSafe()) {
return;
}
super.setUp();

// Deploy handler, manager and module
Expand Down
18 changes: 2 additions & 16 deletions test/integration/SafeRecovery/SafeRecovery.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,14 @@ contract SafeRecovery_Integration_Test is SafeIntegrationBase {
using ModuleKitHelpers for *;
using ModuleKitUserOp for *;

string currentAccountType;

function setUp() public override {
super.setUp();
}

/**
* Helper function to skip tests if account type is not Safe. These tests only succeed when the
* account type is a Safe
*/
function skipIfAccountTypeNotSafe() public {
currentAccountType = vm.envOr("ACCOUNT_TYPE", string(""));

if (Strings.equal(currentAccountType, "SAFE")) {
vm.skip(false);
} else {
function test_Recover_RotatesOwnerSuccessfully() public {
if (!isAccountTypeSafe()) {
vm.skip(true);
}
}

function test_Recover_RotatesOwnerSuccessfully() public {
skipIfAccountTypeNotSafe();

bytes memory recoveryCalldata = abi.encodeWithSignature(
"swapOwner(address,address,address)", address(1), owner1, newOwner1
Expand Down

0 comments on commit c1efbbb

Please sign in to comment.