Skip to content

Commit

Permalink
✅ Add test_initializerDisabledAfterDeployment
Browse files Browse the repository at this point in the history
  • Loading branch information
Flocqst committed Sep 11, 2024
1 parent 9cae643 commit 24a96c5
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/Upgrade.t.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.25;

import {Initializable} from
"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import {IKSXVault} from "src/interfaces/IKSXVault.sol";
import {Bootstrap, KSXVault} from "test/utils/Bootstrap.sol";
import {MockVaultUpgrade} from "test/utils/mocks/MockVaultUpgrade.sol";
Expand Down Expand Up @@ -75,4 +77,18 @@ contract MockUpgrade is UpgradeTest {
ksxVault.upgradeToAndCall(address(mockVaultUpgrade), "");
}

function test_initializerDisabledAfterDeployment() public {
// Vault is already initialized in the setUp()

// Try to initialize again
vm.expectRevert(
abi.encodeWithSelector(Initializable.InvalidInitialization.selector)
);

ksxVault.initialize(address(0x00));

// Verify that the token address did not change
assertEq(address(ksxVault.asset()), _token);
}

}

0 comments on commit 24a96c5

Please sign in to comment.