Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Add more tests #368

Merged
merged 2 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions test/unit/gateway/GasService.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ contract GasServiceTest is Test {
}

function testDeployment() public {
service = new GasService(MESSAGE_COST, PROOF_COST, GAS_PRICE, TOKEN_PRICE);
assertEq(service.wards(address(this)), 1);
assertEq(service.messageCost(), MESSAGE_COST);
assertEq(service.proofCost(), PROOF_COST);
Expand All @@ -40,6 +41,10 @@ contract GasServiceTest is Test {

vm.expectRevert(bytes("GasService/file-unrecognized-param"));
service.file(what, messageCost);

vm.prank(makeAddr("unauthorized"));
vm.expectRevert("Auth/not-authorized");
service.file("messageCost", messageCost);
}

function testUpdateGasPrice(uint128 value) public {
Expand All @@ -66,11 +71,19 @@ contract GasServiceTest is Test {
service.updateGasPrice(value, futureDate);
assertEq(service.gasPrice(), value);
assertEq(service.lastUpdatedAt(), futureDate);

vm.prank(makeAddr("unauthorized"));
vm.expectRevert("Auth/not-authorized");
service.updateGasPrice(value, futureDate);
}

function testUpdateTokenPrice(uint256 value) public {
service.updateTokenPrice(value);
assertEq(service.tokenPrice(), value);

vm.prank(makeAddr("unauthorized"));
vm.expectRevert("Auth/not-authorized");
service.updateTokenPrice(value);
}

function testEstimateFunction(bytes calldata message) public {
Expand Down
4 changes: 4 additions & 0 deletions test/unit/gateway/adapters/axelar/Adapter.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ contract AxelarAdapterTest is Test {

vm.expectRevert(bytes("AxelarAdapterfile-unrecognized-param"));
adapter.file("random", value);

vm.prank(makeAddr("unauthorized"));
vm.expectRevert("Auth/not-authorized");
adapter.file("axelarCost", value);
}

function testPayment(bytes calldata payload, uint256 value) public {
Expand Down
Loading