Skip to content

Commit

Permalink
test owner
Browse files Browse the repository at this point in the history
  • Loading branch information
kumaryash90 committed Oct 20, 2023
1 parent 7e1452d commit 94d081d
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 0 deletions.
58 changes: 58 additions & 0 deletions src/test/tokenerc1155-BTT/owner/owner.t.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

import "../../utils/BaseTest.sol";

import { TWProxy } from "contracts/infra/TWProxy.sol";

contract MyTokenERC1155 is TokenERC1155 {}

contract TokenERC1155Test_Owner is BaseTest {
address public implementation;
address public proxy;

MyTokenERC1155 internal tokenContract;

function setUp() public override {
super.setUp();

// Deploy implementation.
implementation = address(new MyTokenERC1155());

// Deploy proxy pointing to implementaion.
vm.prank(deployer);
proxy = address(
new TWProxy(
implementation,
abi.encodeCall(
TokenERC1155.initialize,
(
deployer,
NAME,
SYMBOL,
CONTRACT_URI,
forwarders(),
saleRecipient,
royaltyRecipient,
royaltyBps,
platformFeeBps,
platformFeeRecipient
)
)
)
);

tokenContract = MyTokenERC1155(proxy);
}

function test_owner() public {
assertEq(tokenContract.owner(), deployer);
}

function test_owner_notDefaultAdmin() public {
vm.prank(deployer);
tokenContract.renounceRole(bytes32(0x00), deployer);

assertEq(tokenContract.owner(), address(0));
}
}
6 changes: 6 additions & 0 deletions src/test/tokenerc1155-BTT/owner/owner.tree
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
owner()
├── when private variable `_owner` DEFAULT_ADMIN_ROLE
│ └── it should return `_owner` ✅
└── when private variable `_owner` doesn't have DEFAULT_ADMIN_ROLE
└── it should return address(0) ✅

0 comments on commit 94d081d

Please sign in to comment.