mirror of
https://github.com/lens-protocol/core.git
synced 2026-04-22 03:02:03 -04:00
test: Tests moved from Follow NFT to Follow tests
This commit is contained in:
@@ -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
|
||||
//////////////////////////////////////////////////////////
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user