mirror of
https://github.com/lens-protocol/core.git
synced 2026-04-22 03:02:03 -04:00
feat: More helpers and scen tests
This commit is contained in:
@@ -77,7 +77,7 @@ contract CollectingTest_Generic is CollectingTest_Base {
|
||||
// SCENARIOS
|
||||
|
||||
function testCollect() public {
|
||||
assertEq(hub.getCollectNFT(mockCollectData.profileId, mockCollectData.pubId), address(0));
|
||||
_checkCollectNFTBefore();
|
||||
|
||||
vm.startPrank(profileOwner);
|
||||
uint256 nftId = _mockCollect();
|
||||
@@ -87,7 +87,7 @@ contract CollectingTest_Generic is CollectingTest_Base {
|
||||
}
|
||||
|
||||
function testCollectMirror() public {
|
||||
assertEq(hub.getCollectNFT(mockCollectData.profileId, mockCollectData.pubId), address(0));
|
||||
_checkCollectNFTBefore();
|
||||
|
||||
vm.startPrank(profileOwner);
|
||||
hub.mirror(mockMirrorData);
|
||||
@@ -98,7 +98,7 @@ contract CollectingTest_Generic is CollectingTest_Base {
|
||||
}
|
||||
|
||||
function testExecutorCollect() public {
|
||||
assertEq(hub.getCollectNFT(mockCollectData.profileId, mockCollectData.pubId), address(0));
|
||||
_checkCollectNFTBefore();
|
||||
|
||||
// delegate power to executor
|
||||
vm.prank(profileOwner);
|
||||
@@ -112,7 +112,22 @@ contract CollectingTest_Generic is CollectingTest_Base {
|
||||
_checkCollectNFTAfter(nftId);
|
||||
}
|
||||
|
||||
function testExecutorCollectMirror() public {}
|
||||
function testExecutorCollectMirror() public {
|
||||
_checkCollectNFTBefore();
|
||||
|
||||
// mirror, then delegate power to executor
|
||||
vm.startPrank(profileOwner);
|
||||
hub.mirror(mockMirrorData);
|
||||
_setDelegatedExecutorApproval(otherSigner, true);
|
||||
vm.stopPrank();
|
||||
|
||||
// collect from executor
|
||||
vm.startPrank(otherSigner);
|
||||
uint256 nftId = _mockCollect();
|
||||
vm.stopPrank();
|
||||
|
||||
_checkCollectNFTAfter(nftId);
|
||||
}
|
||||
}
|
||||
|
||||
contract CollectingTest_WithSig is CollectingTest_Base {
|
||||
|
||||
@@ -10,6 +10,11 @@ contract CollectingHelpers is TestSetup {
|
||||
|
||||
CollectNFT _collectNftAfter;
|
||||
|
||||
function _checkCollectNFTBefore() internal {
|
||||
// collect NFT doesn't exist yet
|
||||
assertEq(hub.getCollectNFT(mockCollectData.profileId, mockCollectData.pubId), address(0));
|
||||
}
|
||||
|
||||
function _checkCollectNFTAfter(uint256 nftId) internal {
|
||||
_collectNftAfter = CollectNFT(
|
||||
hub.getCollectNFT(mockCollectData.profileId, mockCollectData.pubId)
|
||||
|
||||
Reference in New Issue
Block a user