Skip to content

Commit

Permalink
fix: integration test fails
Browse files Browse the repository at this point in the history
  • Loading branch information
RamboGj committed Nov 20, 2024
1 parent e1d08c1 commit 8b949be
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 8 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@ docs/

# Dotenv file
.env

.DS_Store
zkout/
1 change: 0 additions & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@ libs = ["lib"]
remappings = [
"@chainlink/contracts/=lib/chainlink-brownie-contracts/contracts/",
]
ffi = true

# See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options
2 changes: 1 addition & 1 deletion script/DeployFundMe.s.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;
pragma solidity ^0.8.18;

import {Script} from "forge-std/Script.sol";
import {FundMe} from "../src/FundMe.sol";
Expand Down
2 changes: 1 addition & 1 deletion script/HelperConfig.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Sepolia ETH/USD
// Mainnet ETH/USD
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;
pragma solidity ^0.8.18;

import {Script} from "forge-std/Script.sol";
import {MockV3Aggregator} from "../test/mocks/MockV3Aggregator.sol";
Expand Down
2 changes: 1 addition & 1 deletion script/Interactions.s.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier
pragma solidity ^0.8.28;
pragma solidity ^0.8.18;

import {Script, console} from "forge-std/Script.sol";
import {FundMe} from "../src/FundMe.sol";
Expand Down
7 changes: 4 additions & 3 deletions test/integration/InteractionsTest.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier
pragma solidity ^0.8.28;
pragma solidity ^0.8.18;

import {Test, console} from "forge-std/Test.sol";
import {FundMe} from "../../src/FundMe.sol";
Expand All @@ -10,8 +10,7 @@ contract InteractionsTest is Test {
FundMe fundMe;
address USER = makeAddr("me");
uint256 constant SEND_VALUE = 0.1 ether;
uint256 constant STARTING_BALANCE = 10 ether;
uint256 constant GAS_PRICE = 1;
uint256 constant STARTING_BALANCE = 1 ether;

function setUp() external {
DeployFundMe deployFundMe = new DeployFundMe();
Expand All @@ -21,6 +20,8 @@ contract InteractionsTest is Test {

function testUserCandFundInteractions() public {
FundFundMe fundFundMe = new FundFundMe();

vm.prank(USER);
fundFundMe.fundFundMe(address(fundMe));

WithdrawFundMe withdrawFundMe = new WithdrawFundMe();
Expand Down
2 changes: 1 addition & 1 deletion test/unit/FundMeTest.t.sol
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier
pragma solidity ^0.8.28;
pragma solidity ^0.8.18;

import {Test, console} from "forge-std/Test.sol";
import {FundMe} from "../../src/FundMe.sol";
Expand Down
30 changes: 30 additions & 0 deletions test/unit/ZkSyncDevOps.t.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.18;

import {Test, console} from "forge-std/Test.sol";
import {ZkSyncChainChecker} from "lib/foundry-devops/src/ZkSyncChainChecker.sol";
import {FoundryZkSyncChecker} from "lib/foundry-devops/src/FoundryZkSyncChecker.sol";

contract ZkSyncDevOps is Test, ZkSyncChainChecker, FoundryZkSyncChecker {
// Remove the `skipZkSync`, then run `forge test --mt testZkSyncChainFails --zksync` and this will fail!
function testZkSyncChainFails() public skipZkSync {
address ripemd = address(uint160(3));

bool success;
// Don't worry about what this "assembly" thing is for now
assembly {
success := call(gas(), ripemd, 0, 0, 0, 0, 0)
}
assert(success);
}

// You'll need `ffi=true` in your foundry.toml to run this test
// // Remove the `onlyVanillaFoundry`, then run `foundryup-zksync` and then
// // `forge test --mt testZkSyncFoundryFails --zksync`
// // and this will fail!
// function testZkSyncFoundryFails() public onlyVanillaFoundry {
// bool exists = vm.keyExistsJson('{"hi": "true"}', ".hi");
// assert(exists);
// }
}

0 comments on commit 8b949be

Please sign in to comment.