Skip to content

Commit

Permalink
test: add missing errors, events and 'ModuleKeeper' constructor test
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielstoica committed Aug 12, 2024
1 parent 92babaf commit d2c74a3
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
20 changes: 20 additions & 0 deletions test/unit/concrete/module-keeper/constructor.t.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.26;

import { ModuleKeeper } from "./../../../../src/ModuleKeeper.sol";
import { Base_Test } from "../../../Base.t.sol";

contract Constructor_ModuleKeeper_Test is Base_Test {
function setUp() public virtual override {
Base_Test.setUp();
}

function test_Constructor() external {
// Run the test
ModuleKeeper moduleKeeper = new ModuleKeeper({ _initialOwner: users.admin });

// Assert the actual and expected owner
address owner = moduleKeeper.owner();
assertEq(owner, users.admin);
}
}
3 changes: 3 additions & 0 deletions test/utils/Errors.sol
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,7 @@ library Errors {

/// @notice Thrown when `msg.sender` is not the contract owner
error Unauthorized();

/// @notice Thrown when `msg.sender` is not authorized to perform an operation
error OwnableUnauthorizedAccount(address account);
}
8 changes: 7 additions & 1 deletion test/utils/Events.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { UD60x18 } from "@prb/math/src/UD60x18.sol";
/// @notice Abstract contract to store all the events emitted in the tested contracts
abstract contract Events {
/*//////////////////////////////////////////////////////////////////////////
MODULE-KEEPER
DOCK-REGISTRY
//////////////////////////////////////////////////////////////////////////*/

/// @notice Emitted when a new {Container} contract gets deployed
Expand Down Expand Up @@ -37,6 +37,12 @@ abstract contract Events {
/// @param newModuleKeeper The new address of the {ModuleKeeper}
event ModuleKeeperUpdated(ModuleKeeper newModuleKeeper);

/// @dev Emitted when the contract has been initialized or reinitialized
event Initialized(uint64 version);

/// @dev Emitted when the implementation is upgraded
event Upgraded(address indexed implementation);

/*//////////////////////////////////////////////////////////////////////////
CONTAINER
//////////////////////////////////////////////////////////////////////////*/
Expand Down

0 comments on commit d2c74a3

Please sign in to comment.