Skip to content

Commit

Permalink
test: expect precise error
Browse files Browse the repository at this point in the history
  • Loading branch information
ChiTimesChi committed Sep 19, 2024
1 parent 1cbffb7 commit 4f76cec
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions contracts/messaging/MessageBusManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import {Ownable} from "@openzeppelin/contracts-4.5.0/access/Ownable.sol";
contract MessageBusManager is IManager, Ownable {
address public immutable MESSAGE_BUS;

error MessageBusManager__NotFailed(bytes32 messageId);

constructor(address messageBus_, address owner_) {
MESSAGE_BUS = messageBus_;
transferOwnership(owner_);
Expand Down
4 changes: 2 additions & 2 deletions test/messaging/MessageBusManager.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ contract MessageBusManagerTest is Test {
messageBus.setMessageStatus(messageIds[0], MessageBusReceiver.TxStatus.Fail);
messageBus.setMessageStatus(messageIds[1], MessageBusReceiver.TxStatus.Null);
messageBus.setMessageStatus(messageIds[2], MessageBusReceiver.TxStatus.Fail);
vm.expectRevert();
vm.expectRevert(abi.encodeWithSelector(MessageBusManager.MessageBusManager__NotFailed.selector, messageIds[1]));
vm.prank(owner);
manager.resetFailedMessages(messageIds);
}
Expand All @@ -195,7 +195,7 @@ contract MessageBusManagerTest is Test {
messageBus.setMessageStatus(messageIds[0], MessageBusReceiver.TxStatus.Fail);
messageBus.setMessageStatus(messageIds[1], MessageBusReceiver.TxStatus.Fail);
messageBus.setMessageStatus(messageIds[2], MessageBusReceiver.TxStatus.Success);
vm.expectRevert();
vm.expectRevert(abi.encodeWithSelector(MessageBusManager.MessageBusManager__NotFailed.selector, messageIds[2]));
vm.prank(owner);
manager.resetFailedMessages(messageIds);
}
Expand Down

0 comments on commit 4f76cec

Please sign in to comment.