Skip to content

Commit 39eef0d

Browse files
committed
refactor: add constructor tests
1 parent 7eb67ae commit 39eef0d

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

contracts/test/core/GasTankDepositorTest.sol

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,24 @@ contract GasTankDepositorTest is Test {
2626
_gasTankDepositorImpl = new GasTankDepositor(rpcService, MAXIMUM_DEPOSIT);
2727
}
2828

29+
//=======================TESTS FOR CONSTRUCTOR=======================
30+
31+
function testConstructorRevertsWhenRpcServiceIsZeroAddress() public {
32+
vm.expectRevert(abi.encodeWithSelector(GasTankDepositor.RPCServiceNotSet.selector, ZERO_ADDRESS));
33+
new GasTankDepositor(ZERO_ADDRESS, MAXIMUM_DEPOSIT);
34+
}
35+
36+
function testConstructorRevertsWhenMaximumDepositIsZero() public {
37+
vm.expectRevert(abi.encodeWithSelector(GasTankDepositor.MaximumDepositNotMet.selector, 0, 0));
38+
new GasTankDepositor(rpcService, 0);
39+
}
40+
41+
function testConstructorSetsVariables() public view {
42+
assertEq(_gasTankDepositorImpl.RPC_SERVICE(), rpcService);
43+
assertEq(_gasTankDepositorImpl.MAXIMUM_DEPOSIT(), MAXIMUM_DEPOSIT);
44+
assertEq(_gasTankDepositorImpl.GAS_TANK_ADDRESS(), address(_gasTankDepositorImpl));
45+
}
46+
2947
//=======================TESTS=======================
3048

3149
function testSetsDelegationCodeAtAddress() public {

0 commit comments

Comments
 (0)