-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d7643d0
commit 35fe656
Showing
3 changed files
with
47 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.21; | ||
|
||
import {PBHVerifierTest} from "./PBHVerifierTest.sol"; | ||
import {IWorldIDGroups} from "@world-id-contracts/interfaces/IWorldIDGroups.sol"; | ||
|
||
import {PBHVerifierImplV1 as PBHVerifierImpl} from "../src/PBHVerifierImplV1.sol"; | ||
import {PBHVerifier} from "../src/PBHVerifier.sol"; | ||
|
||
/// @title World ID Router Construction Tests | ||
/// @notice Contains tests for the WorldID router | ||
/// @author Worldcoin | ||
/// @dev This test suite tests both the proxy and the functionality of the underlying implementation | ||
/// so as to test everything in the context of how it will be deployed. | ||
contract PBHVerifierConstruction is PBHVerifierTest { | ||
/// @notice Taken from Initializable.sol | ||
event Initialized(uint8 version); | ||
|
||
/// @notice Tests if it is possible to construct a router without a delegate. | ||
function testCanConstructPBHVerifierWithNoDelegate() public { | ||
// Setup | ||
address dummy = address(this); | ||
bytes memory data = new bytes(0x0); | ||
|
||
// Test | ||
pbhVerifier = new PBHVerifier(dummy, data); | ||
} | ||
|
||
/// @notice Tests that it is possible to properly construct and initialise a router. | ||
function testCanConstructRouterWithDelegate(IWorldIDGroups dummy) public { | ||
// Setup | ||
vm.expectEmit(true, true, true, true); | ||
emit Initialized(1); | ||
pbhVerifierImpl = new PBHVerifierImpl(); | ||
bytes memory callData = abi.encodeCall(PBHVerifierImpl.initialize, (dummy, 30)); | ||
|
||
// Test | ||
pbhVerifier = new PBHVerifier(address(pbhVerifierImpl), callData); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters