test: Tests moved from Follow NFT to Follow tests

This commit is contained in:
donosonaumczuk
2023-01-24 18:57:52 -03:00
parent 9e4270e7f3
commit 94e22bfb83
2 changed files with 49 additions and 55 deletions

View File

@@ -183,33 +183,6 @@ contract FollowNFTTest is BaseTest, ERC721Test {
followNFT.ownerOf(assignedTokenId);
}
//////////////////////////////////////////////////////////
// Follow - With unwrapped token - Negatives
//////////////////////////////////////////////////////////
function testCannotFollowWithUnwrappedTokenIfExecutorIsNotTheProfileOwnerOrHisApprovedExecutor(
address executor
) public {
vm.assume(executor != followerProfileOwner);
vm.assume(executor != address(0));
vm.assume(!hub.isDelegatedExecutorApproved(followerProfileOwner, executor));
assertTrue(followNFT.isFollowing(alreadyFollowingProfileId));
uint256 followTokenId = followNFT.getFollowTokenId(alreadyFollowingProfileId);
assertFalse(followNFT.exists(followTokenId));
vm.prank(address(hub));
vm.expectRevert(IFollowNFT.DoesNotHavePermissions.selector);
followNFT.follow({
followerProfileId: followerProfileId,
executor: executor,
followerProfileOwner: followerProfileOwner,
followTokenId: followTokenId
});
}
//////////////////////////////////////////////////////////
// Follow - With unwrapped token - Scenarios
//////////////////////////////////////////////////////////
@@ -308,34 +281,6 @@ contract FollowNFTTest is BaseTest, ERC721Test {
assertEq(followNFT.getFollowApproved(followTokenId), 0);
}
//////////////////////////////////////////////////////////
// Follow - With wrapped token - Negatives
//////////////////////////////////////////////////////////
function testCannotFollowWithWrappedTokenIfExecutorIsNotTheProfileOwnerOrHisApprovedExecutor(
address executor
) public {
vm.assume(executor != followerProfileOwner);
vm.assume(executor != address(0));
vm.assume(!hub.isDelegatedExecutorApproved(followerProfileOwner, executor));
assertTrue(followNFT.isFollowing(alreadyFollowingProfileId));
uint256 followTokenId = followNFT.getFollowTokenId(alreadyFollowingProfileId);
vm.prank(alreadyFollowingProfileOwner);
followNFT.untieAndWrap(followTokenId);
vm.prank(address(hub));
vm.expectRevert(IFollowNFT.DoesNotHavePermissions.selector);
followNFT.follow({
followerProfileId: followerProfileId,
executor: executor,
followerProfileOwner: followerProfileOwner,
followTokenId: followTokenId
});
}
//////////////////////////////////////////////////////////
// Follow - With wrapped token - Scenarios
//////////////////////////////////////////////////////////

View File

@@ -116,6 +116,55 @@ contract FollowTest is BaseTest, AssumptionHelpers {
});
}
function testCannotFollowWithUnwrappedTokenIfExecutorIsNotTheProfileOwnerOrHisApprovedExecutor(
uint256 executorPk
) public {
vm.assume(_isValidPk(executorPk));
address executor = vm.addr(executorPk);
vm.assume(executor != address(0));
vm.assume(executor != followerProfileOwner);
vm.assume(!hub.isDelegatedExecutorApproved(followerProfileOwner, executor));
uint256 followTokenId = followNFT.getFollowTokenId(alreadyFollowingProfileId);
assertFalse(followNFT.exists(followTokenId));
vm.expectRevert(Errors.ExecutorInvalid.selector);
_follow({
pk: executorPk,
isFollowerProfileOwner: false,
followerProfileId: followerProfileId,
idsOfProfilesToFollow: _toUint256Array(targetProfileId),
followTokenIds: _toUint256Array(followTokenId),
datas: _toBytesArray('', '')
});
}
function testCannotFollowWithWrappedTokenIfExecutorIsNotTheProfileOwnerOrHisApprovedExecutor(
uint256 executorPk
) public {
vm.assume(_isValidPk(executorPk));
address executor = vm.addr(executorPk);
vm.assume(executor != address(0));
vm.assume(executor != followerProfileOwner);
vm.assume(!hub.isDelegatedExecutorApproved(followerProfileOwner, executor));
uint256 followTokenId = followNFT.getFollowTokenId(alreadyFollowingProfileId);
vm.prank(alreadyFollowingProfileOwner);
followNFT.untieAndWrap(followTokenId);
vm.expectRevert(Errors.ExecutorInvalid.selector);
_follow({
pk: executorPk,
isFollowerProfileOwner: false,
followerProfileId: followerProfileId,
idsOfProfilesToFollow: _toUint256Array(targetProfileId),
followTokenIds: _toUint256Array(followTokenId),
datas: _toBytesArray('', '')
});
}
function testCannotFollowIfAmountOfTokenIdsPassedDiffersFromAmountOfProfilesToFollow() public {
vm.expectRevert(Errors.ArrayMismatch.selector);