Skip to content

Commit

Permalink
improve tests (ethereum-optimism#12937)
Browse files Browse the repository at this point in the history
  • Loading branch information
AmadiMichael authored Nov 15, 2024
1 parent be8c333 commit 2a40d22
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/contracts-bedrock/test/L1/L1ERC721Bridge.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,14 @@ contract L1ERC721Bridge_Test is CommonTest {
assertEq(localToken.ownerOf(tokenId), alice);
}

/// @dev Tests that `bridgeERC721To` reverts if the to address is the zero address.
function test_bridgeERC721To_toZeroAddress_reverts() external {
// Bridge the token.
vm.prank(bob);
vm.expectRevert("ERC721Bridge: nft recipient cannot be address(0)");
l1ERC721Bridge.bridgeERC721To(address(localToken), address(remoteToken), address(0), tokenId, 1234, hex"5678");
}

/// @dev Tests that the ERC721 bridge successfully finalizes a withdrawal.
function test_finalizeBridgeERC721_succeeds() external {
// Bridge the token.
Expand Down
8 changes: 8 additions & 0 deletions packages/contracts-bedrock/test/L2/L2ERC721Bridge.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,14 @@ contract L2ERC721Bridge_Test is CommonTest {
assertEq(localToken.ownerOf(tokenId), alice);
}

/// @dev Tests that `bridgeERC721To` reverts if the to address is the zero address.
function test_bridgeERC721To_toZeroAddress_reverts() external {
// Bridge the token.
vm.prank(bob);
vm.expectRevert("ERC721Bridge: nft recipient cannot be address(0)");
l2ERC721Bridge.bridgeERC721To(address(localToken), address(remoteToken), address(0), tokenId, 1234, hex"5678");
}

/// @dev Tests that `finalizeBridgeERC721` correctly finalizes a bridged token.
function test_finalizeBridgeERC721_succeeds() external {
// Bridge the token.
Expand Down

0 comments on commit 2a40d22

Please sign in to comment.