diff --git a/test/KSXVault.t.sol b/test/KSXVault.t.sol index bf8617a..f91b036 100644 --- a/test/KSXVault.t.sol +++ b/test/KSXVault.t.sol @@ -1,26 +1,38 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.25; -import {Test} from "forge-std/Test.sol"; -import {KSXVault} from "../src/KSXVault.sol"; import {ERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; +import {Test} from "forge-std/Test.sol"; +import {Bootstrap, KSXVault} from "test/utils/Bootstrap.sol"; + +contract KSXVaultTest is Bootstrap { + + function setUp() public { + MockERC20 depositToken = new MockERC20("Deposit Token", "DT"); + initializeLocal(address(depositToken), PDAOADDR); + } -/** @PR:REVIEW no tests for vault **/ -/** @PR:REVIEW add pDAO test **/ -/** @PR:REVIEW add share name **/ -/** @PR:REVIEW add share symbol **/ -/** @PR:REVIEW add use bootstrap everywhere instead of `Test` **/ + function test_share_name() public { + assertEq(ksxVault.name(), "KSX Vault"); + } + + function test_share_symbol() public { + assertEq(ksxVault.symbol(), "KSX"); + } -contract KSXVaultTest is Test { - function setUp() public {} } contract MockERC20 is ERC20 { - constructor(string memory name_, string memory symbol_) + + constructor( + string memory name_, + string memory symbol_ + ) ERC20(name_, symbol_) {} function mint(address to, uint256 amount) external { _mint(to, amount); } + } diff --git a/test/Upgrade.t.sol b/test/Upgrade.t.sol index bb46281..cc51658 100644 --- a/test/Upgrade.t.sol +++ b/test/Upgrade.t.sol @@ -1,35 +1,30 @@ // SPDX-License-Identifier: UNLICENSED pragma solidity 0.8.25; -import {Bootstrap, KSXVault} from "test/utils/Bootstrap.sol"; import {IKSXVault} from "src/interfaces/IKSXVault.sol"; +import {Bootstrap, KSXVault} from "test/utils/Bootstrap.sol"; import {MockVaultUpgrade} from "test/utils/mocks/MockVaultUpgrade.sol"; contract UpgradeTest is Bootstrap { + + address public _pDAO = 0xe826d43961a87fBE71C91d9B73F7ef9b16721C07; + address public _token = 0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85; + function setUp() public { - /** @PR:REVIEW unless there is a specific reason, avoid using fork tests **/ - initializeOptimism(); + initializeLocal(_token, _pDAO); } -} -/** @PR:REVIEW not entirely sure why you split up UpgradeTest/MockUpgrade/UpgradeVault; if no specific reason combine. otherwise thats fine **/ +} contract MockUpgrade is UpgradeTest { + MockVaultUpgrade mockVaultUpgrade; function deployMockVault() internal { - mockVaultUpgrade = new MockVaultUpgrade( - address(TOKEN), - address(pDAO) - ); + mockVaultUpgrade = new MockVaultUpgrade(address(TOKEN), address(pDAO)); } - function test_upgrade() public { - - /** @PR:REVIEW might as well fuzz the messages; never know what might be caught **/ - - string memory message = "hi"; - + function test_upgrade(string memory message) public { bool success; bytes memory response; @@ -60,16 +55,12 @@ contract MockUpgrade is UpgradeTest { ksxVault.upgradeToAndCall(address(mockVaultUpgrade), ""); } -} - -contract UpgradeVault is UpgradeTest {} -contract RemoveUpgradability is UpgradeTest { function test_removeUpgradability() public { - - MockVaultUpgrade mockVaultUpgrade = new MockVaultUpgrade( + mockVaultUpgrade = new MockVaultUpgrade( address(TOKEN), - address(0) // set pDAO to zero address to effectively remove upgradability + address(0) // set pDAO to zero address to effectively remove + // upgradability ); vm.prank(pDAO); @@ -78,8 +69,11 @@ contract RemoveUpgradability is UpgradeTest { vm.prank(pDAO); - vm.expectRevert(abi.encodeWithSelector(IKSXVault.NonUpgradeable.selector)); + vm.expectRevert( + abi.encodeWithSelector(IKSXVault.NonUpgradeable.selector) + ); ksxVault.upgradeToAndCall(address(mockVaultUpgrade), ""); } + }