Skip to content

Commit

Permalink
test folders set up
Browse files Browse the repository at this point in the history
  • Loading branch information
KatrixReloaded committed Aug 29, 2024
1 parent b1be072 commit ef5c351
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions test/unit/RaffleTest.t.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;

import {Test} from "forge-std/Test.sol";
import {Raffle} from "../../src/Raffle.sol";
import {DeployRaffle} from "../../script/DeployRaffle.s.sol";
import {HelperConfig} from "../../script/HelperConfig.s.sol";

contract RaffleTest is Test {
Raffle public raffle;
HelperConfig public helperConfig;

// constructor values for Raffle
uint256 entranceFee;
uint256 interval;
address vrfCoordinator;
bytes32 gasLane;
uint32 callbackGasLimit;
uint256 subscriptionId;

address public PLAYER = makeAddr("player");
uint256 public constant STARTING_PLAYER_BALANCE = 10 ether;

function setUp() public {
DeployRaffle deployer = new DeployRaffle();
(raffle, helperConfig) = deployer.deployContract();
HelperConfig.NetworkConfig memory config = helperConfig.getConfig();

entranceFee = config.entranceFee;
interval = config.interval;
vrfCoordinator = config.vrfCoordinator;
gasLane = config.gasLane;
callbackGasLimit = config.callbackGasLimit;
subscriptionId = config.subscriptionId;

vm.deal(PLAYER, STARTING_PLAYER_BALANCE);
}

function testRaffleInitializesInOpenState() public view {
assert(raffle.getRaffleState() == Raffle.RaffleState.OPEN);
}
}

0 comments on commit ef5c351

Please sign in to comment.