Skip to content
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
25 changes: 25 additions & 0 deletions test/access/Owner/OwnerFacet.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,31 @@ contract OwnerFacetTest is Test {
// Note: Zero address cannot make any calls since it has no private key
}

// ============================================
// Renounce Ownership Direct Call Tests
// ============================================

function test_RenounceOwnership_DirectCall_SetsOwnerToZero() public {
vm.prank(INITIAL_OWNER);
ownerFacet.renounceOwnership();

assertEq(ownerFacet.owner(), ZERO_ADDRESS);
}

function test_RenounceOwnership_DirectCall_EmitsEvent() public {
vm.expectEmit(true, true, false, true);
emit OwnershipTransferred(INITIAL_OWNER, ZERO_ADDRESS);

vm.prank(INITIAL_OWNER);
ownerFacet.renounceOwnership();
}

function test_RevertWhen_RenounceOwnership_CalledByNonOwner() public {
vm.expectRevert(OwnerFacet.OwnerUnauthorizedAccount.selector);
vm.prank(ALICE);
ownerFacet.renounceOwnership();
}

// ============================================
// Edge Cases
// ============================================
Expand Down
27 changes: 27 additions & 0 deletions test/access/OwnerTwoSteps/LibOwnerTwoSteps.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,33 @@ contract LibOwnerTwoStepsTest is Test {
harness.transferOwnership(ALICE);
}

function test_RenounceOwnership_DirectCall_SetsOwnerToZero() public {
vm.prank(INITIAL_OWNER);
harness.renounceOwnership();

assertEq(harness.owner(), ZERO_ADDRESS);
assertEq(harness.pendingOwner(), ZERO_ADDRESS);
}

function test_RenounceOwnership_DirectCall_EmitsEvent() public {
vm.expectEmit(true, true, false, true);
emit OwnershipTransferred(INITIAL_OWNER, ZERO_ADDRESS);

vm.prank(INITIAL_OWNER);
harness.renounceOwnership();
}

function test_RequireOwner_SucceedsForOwner() public {
vm.prank(INITIAL_OWNER);
harness.requireOwner();
}

function test_RevertWhen_RequireOwner_CalledByNonOwner() public {
vm.expectRevert(LibOwnerTwoSteps.OwnerUnauthorizedAccount.selector);
vm.prank(ALICE);
harness.requireOwner();
}

// ============================================
// Sequential Transfer Tests
// ============================================
Expand Down