-
Notifications
You must be signed in to change notification settings - Fork 412
/
Copy pathMessaging.t.sol
38 lines (31 loc) · 1.13 KB
/
Messaging.t.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;
import "forge-std/Test.sol";
import "../contracts/mock/MockMailbox.sol";
import "../contracts/mock/MockMailbox.sol";
import "../contracts/test/TestRecipient.sol";
import "../contracts/interfaces/IMailbox.sol";
import "../contracts/interfaces/IMailbox.sol";
import {TypeCasts} from "../contracts/libs/TypeCasts.sol";
contract MessagingTest is Test {
MockMailbox originMailbox;
MockMailbox remoteMailbox;
TestRecipient receiver;
uint32 originDomain = 1;
uint32 remoteDomain = 2;
function setUp() public {
originMailbox = new MockMailbox(originDomain);
remoteMailbox = new MockMailbox(remoteDomain);
originMailbox.addRemoteMailbox(remoteDomain, remoteMailbox);
receiver = new TestRecipient();
}
function testSendMessage(string calldata _message) public {
originMailbox.dispatch(
remoteDomain,
TypeCasts.addressToBytes32(address(receiver)),
bytes(_message)
);
remoteMailbox.processNextInboundMessage();
assertEq(string(receiver.lastData()), _message);
}
}