Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
wcgcyx committed Dec 11, 2023
1 parent d0bdd2d commit f762271
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions test/unit/root/RootERC20Bridge.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,32 @@ contract RootERC20BridgeUnitTest is Test, IRootERC20BridgeEvents, IRootERC20Brid
rootBridge.mapToken{value: 300}(IERC20Metadata(NATIVE_ETH));
}

function test_SucceedIf_mapTokenWithSupportedMethods() public {
rootBridge.mapToken{value: 300}(token);
}

function test_RevertIf_mapTokenWithoutName() public {
vm.mockCallRevert(address(token), abi.encodeWithSelector(IERC20Metadata.name.selector), "Unsupported operation");
vm.expectRevert(NotSupportedToken.selector);
rootBridge.mapToken{value: 300}(token);
}

function test_RevertIf_mapTokenWithoutSymbol() public {
vm.mockCallRevert(
address(token), abi.encodeWithSelector(IERC20Metadata.symbol.selector), "Unsupported operation"
);
vm.expectRevert(NotSupportedToken.selector);
rootBridge.mapToken{value: 300}(token);
}

function test_RevertIf_mapTokenWithoutDecimals() public {
vm.mockCallRevert(
address(token), abi.encodeWithSelector(IERC20Metadata.decimals.selector), "Unsupported operation"
);
vm.expectRevert(NotSupportedToken.selector);
rootBridge.mapToken{value: 300}(token);
}

function test_updateRootBridgeAdaptor_UpdatesRootBridgeAdaptor() public {
address newAdaptorAddress = address(0x11111);

Expand Down

0 comments on commit f762271

Please sign in to comment.