In forge tests I've been redeclaring events within the test file so that I can use vm.assertEmit
. Is there a way to import events from the contract I am testing instead?
e.g.
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
import "forge-std/Test.sol";
import {RegistryDeployer} from "../src/RegistryDeployer.sol";
contract RegistryDeployerTest is Test {
// re-declare event for assertions
event Deployed();
// ^^^^^^^^^^
// I don't want to have to do this
// ^^^^^^^^^^
function testDeployer() public {
vm.expectEmit(true, true, true, true);
emit Deployed();
new RegistryDeployer();
}
}