Skip to content

Commit

Permalink
improve coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
a17 committed Mar 4, 2024
1 parent 95a3ac3 commit a86702f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/test/BadUpgrade.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.23;

contract BadUpgrade {
function platform() external pure returns (address) {
return address(2);
}
}
7 changes: 7 additions & 0 deletions test/core/Proxy.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,18 @@ import {Test, console} from "forge-std/Test.sol";
import "../../src/core/vaults/CVault.sol";
import "../../src/core/proxy/Proxy.sol";
import "../../src/test/MockVaultUpgrade.sol";
import "../../src/test/BadUpgrade.sol";
import "../base/MockSetup.sol";

contract ProxyTest is Test, MockSetup {
Proxy public proxy;
MockVaultUpgrade public vaultImplementationUpgrade;
BadUpgrade public badUpgrade;

function setUp() public {
proxy = new Proxy();
vaultImplementationUpgrade = new MockVaultUpgrade();
badUpgrade = new BadUpgrade();
}

function testInitProxy() public {
Expand Down Expand Up @@ -54,5 +57,9 @@ contract ProxyTest is Test, MockSetup {
assertEq(proxy.implementation(), address(vaultImplementationUpgrade));
assertGt(vault.createdBlock(), 0);
assertEq(IControllable(address(vault)).platform(), address(platform));

vm.prank(address(platform));
vm.expectRevert(IControllable.NotPlatform.selector);
proxy.upgrade(address(badUpgrade));
}
}
1 change: 1 addition & 0 deletions test/core/Vault.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ contract VaultTest is Test, FullMockSetup {
strategy.description();
strategy.initVariants(address(0));
strategy.isHardWorkOnDepositAllowed();
strategy.isReadyForHardWork();
}

function testDepositWithdrawHardWork() public {
Expand Down

0 comments on commit a86702f

Please sign in to comment.