Skip to content

Commit

Permalink
add registration of component with empty name (#690)
Browse files Browse the repository at this point in the history
  • Loading branch information
doerfli committed Sep 10, 2024
1 parent 16a847c commit 03b8c11
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions test/component/registration/ComponentTracking.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {SimpleProduct} from "../../../contracts/examples/unpermissioned/SimplePr
import {SimpleDistribution} from "../../../contracts/examples/unpermissioned/SimpleDistribution.sol";
import {SimpleOracle} from "../../../contracts/examples/unpermissioned/SimpleOracle.sol";
import {SimplePool} from "../../../contracts/examples/unpermissioned/SimplePool.sol";
import {IComponent} from "../../../contracts/shared/IComponent.sol";
import {IComponents} from "../../../contracts/instance/module/IComponents.sol";
import {IComponentService} from "../../../contracts/shared/IComponentService.sol";

Expand Down Expand Up @@ -211,6 +212,30 @@ contract ComponentTrackingTest is GifTest {

}

function test_componentEmptyName() public {
// GIVEN
assertEq(instanceReader.components(), 0, "unexpected components count (before)");
assertEq(instanceReader.products(), 0, "unexpected products count (before)");

// WHEN
vm.startPrank(instanceOwner);

IComponents.ProductInfo memory productInfo = _getSimpleProductInfo();
IComponents.FeeInfo memory feeInfo = _getSimpleFeeInfo();
BasicProductAuthorization auth = new BasicProductAuthorization("empty name");

vm.expectRevert(abi.encodeWithSelector(
IComponent.ErrorComponentNameLengthZero.selector));
new SimpleProduct(
address(registry),
instanceNftId,
"",
productInfo,
feeInfo,
auth,
instanceOwner);
}


function _deployProduct(
string memory name,
Expand Down

0 comments on commit 03b8c11

Please sign in to comment.