Skip to content

Commit

Permalink
tests updated
Browse files Browse the repository at this point in the history
  • Loading branch information
KatrixReloaded committed Sep 13, 2024
1 parent 89b475a commit e0e0afc
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions test/unit/RaffleTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ 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";
import {HelperConfig, CodeConstants} from "../../script/HelperConfig.s.sol";
import {Vm} from "forge-std/Vm.sol";
import {VRFCoordinatorV2_5Mock} from "@chainlink/contracts/v0.8/vrf/mocks/VRFCoordinatorV2_5Mock.sol";

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

Expand Down Expand Up @@ -155,14 +155,21 @@ contract RaffleTest is Test {
/*///////////////////////////////////////////////////
FULFILLRANDOMWORDS
///////////////////////////////////////////////////*/
function testFulfillRandomWordsCanOnlyBeCalledAfterPerformUpkeep(uint256 randomRequestId) public raffleEntered {
modifier skipFork() {
if(block.chainid != LOCAL_CHAINID) {
return;
}
_;
}

function testFulfillRandomWordsCanOnlyBeCalledAfterPerformUpkeep(uint256 randomRequestId) public raffleEntered skipFork {
// Arrange / Act / Assert
vm.expectRevert(VRFCoordinatorV2_5Mock.InvalidRequest.selector);
VRFCoordinatorV2_5Mock(vrfCoordinator).fulfillRandomWords(randomRequestId, address(raffle));
}

// BIG TEST
function testFulfillRandomWordsPicksAWinnerResetsAndSendsMoney() public raffleEntered {
function testFulfillRandomWordsPicksAWinnerResetsAndSendsMoney() public raffleEntered skipFork {
// Arrange
uint256 additionalEntrants = 3;
uint256 startingIndex = 1;
Expand Down

0 comments on commit e0e0afc

Please sign in to comment.