@@ -50,38 +50,35 @@ contract MessageBusSenderTest is Test {
50
50
}
51
51
52
52
// Test fee query on an unset dstChain
53
- function testFailUnsetEstimateFee () public {
53
+ function testUnsetEstimateFeeRevert () public {
54
+ vm.expectRevert ("Fee not set " );
54
55
messageBusSender.estimateFee (1 , bytes ("" ));
55
56
}
56
57
57
- function testFailSendMessageWrongChainID () public {
58
+ function testSendMessageWrongChainIDRevert () public {
58
59
bytes32 receiverAddress = addressToBytes32 (address (1337 ));
59
60
// 99 is default foundry chain id
61
+ vm.expectRevert ("Fee not set " );
60
62
messageBusSender.sendMessage (receiverAddress, 99 , bytes ("" ), bytes ("" ));
61
63
}
62
64
63
65
// Enforce fees above returned fee amount from fee calculator
64
- function testFailSendMessageWithLowFees () public {
65
- uint256 estimatedFee = messageBusSender.estimateFee (gasFeePricingTest.expectedDstChainId (), bytes ("" ));
66
+ function testSendMessageWithLowFeesRevert () public {
67
+ uint256 dstChainId = gasFeePricingTest.expectedDstChainId ();
68
+ uint256 estimatedFee = messageBusSender.estimateFee (dstChainId, bytes ("" ));
66
69
bytes32 receiverAddress = addressToBytes32 (address (1337 ));
67
- messageBusSender.sendMessage {value: estimatedFee - 1 }(
68
- receiverAddress,
69
- gasFeePricingTest.expectedDstChainId (),
70
- bytes ("" ),
71
- bytes ("" )
72
- );
70
+ vm.expectRevert ("Insuffient gas fee " );
71
+ messageBusSender.sendMessage {value: estimatedFee - 1 }(receiverAddress, dstChainId, bytes ("" ), bytes ("" ));
73
72
}
74
73
75
74
// Fee calculator reverts upon 0 fees (Fee is unset)
76
- function testFailMessageOnUnsetFees () public {
77
- uint256 estimatedFee = messageBusSender.estimateFee (gasFeePricingTest.expectedDstChainId () - 1 , bytes ("" ));
75
+ function testMessageOnUnsetFeesRevert () public {
76
+ uint256 dstChainId = gasFeePricingTest.expectedDstChainId () - 1 ;
77
+ vm.expectRevert ("Fee not set " );
78
+ uint256 estimatedFee = messageBusSender.estimateFee (dstChainId, bytes ("" ));
78
79
bytes32 receiverAddress = addressToBytes32 (address (1337 ));
79
- messageBusSender.sendMessage {value: estimatedFee}(
80
- receiverAddress,
81
- gasFeePricingTest.expectedDstChainId () - 1 ,
82
- bytes ("" ),
83
- bytes ("" )
84
- );
80
+ vm.expectRevert ("Fee not set " );
81
+ messageBusSender.sendMessage {value: estimatedFee}(receiverAddress, dstChainId, bytes ("" ), bytes ("" ));
85
82
}
86
83
87
84
// Send message without reversion, pay correct amount of fees, emit correct event
0 commit comments