feat: More helpers and scen tests

This commit is contained in:
Ben Sparks
2022-11-03 13:45:16 +02:00
parent 5ab459a337
commit ae2b402501
2 changed files with 24 additions and 4 deletions

View File

@@ -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 {

View File

@@ -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)