Skip to content

Commit

Permalink
✅ Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JaredBorders committed Aug 7, 2023
1 parent e5fa527 commit f4be9b0
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 0 deletions.
49 changes: 49 additions & 0 deletions test/unit/Auth.t.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.18;

import {Auth} from "src/authentication/Auth.sol";
import {OPTIMISM_GOERLI_PERPS_MARKET_PROXY} from
"script/utils/parameters/OptimismGoerliParameters.sol";
import {Test} from "lib/forge-std/src/Test.sol";

contract AuthenticationTest is Test {
Auth auth;

function setUp() public {
vm.rollFork(13_006_356);

auth = new Auth(OPTIMISM_GOERLI_PERPS_MARKET_PROXY);
}
}

contract CreateAccount is AuthenticationTest {
function test_CreateAccount() public {
uint128 accountId = auth.createAccount();
assert(accountId != 0);
}
}

contract AccountOwnership is AuthenticationTest {
address owner = address(0x1);

function test_AccountOwnership() public {
vm.startPrank(owner);

uint128 accountId = auth.createAccount();

bool isOwner = auth.isCallerAccountOwner(accountId);
assertTrue(isOwner);

vm.stopPrank();
}
}

contract Delegation is AuthenticationTest {
address owner = address(0x1);
address delegate1 = address(0x2);
address delegate2 = address(0x3);
address delegate3 = address(0x4);
uint128 accountId1;
uint128 accountId2;
uint128 accountId3;
}
2 changes: 2 additions & 0 deletions test/unit/MarginEngine.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ contract MarginEngineTest is Test, MarginEngine {
MarginEngine marginEngine;

function setUp() public {
vm.rollFork(13_006_356);

marginEngine = new MarginEngine();
}
}
Expand Down

0 comments on commit f4be9b0

Please sign in to comment.