mirror of
https://github.com/lens-protocol/core.git
synced 2026-01-14 00:18:03 -05:00
feat: Added more collect tests
This commit is contained in:
@@ -212,36 +212,22 @@ contract CollectingTest_WithSig is CollectingTest_Base {
|
||||
_mockCollectWithSig({delegatedSigner: address(0), signerPrivKey: profileOwnerKey});
|
||||
}
|
||||
|
||||
function testCannotCollectWithSigIfNonceWasIncrementedWithAnotherAction() public {
|
||||
// TODO clean up
|
||||
address delegatedSigner = address(0);
|
||||
uint256 signerPrivKey = profileOwnerKey;
|
||||
|
||||
function testCannotCollectIfNonceWasIncrementedWithAnotherAction() public {
|
||||
assertEq(_getSigNonce(profileOwner), nonce, 'Wrong nonce before posting');
|
||||
|
||||
// cancel with permitForAll
|
||||
uint256 expectedCollectId = _getCollectCount(firstProfileId, mockCollectData.pubId) + 1;
|
||||
|
||||
// bytes32 collectDigest = _getCollectTypedDataHash(
|
||||
// mockCollectData.profileId,
|
||||
// mockCollectData.pubId,
|
||||
// mockCollectData.data,
|
||||
// nonce,
|
||||
// deadline
|
||||
// );
|
||||
uint256 nftId = _mockCollectWithSig({
|
||||
delegatedSigner: address(0),
|
||||
signerPrivKey: profileOwnerKey
|
||||
});
|
||||
|
||||
// hub.permitForAll();
|
||||
assertEq(nftId, expectedCollectId, 'Wrong collectId');
|
||||
|
||||
// _collectWithSig(
|
||||
// _buildCollectWithSigData(
|
||||
// delegatedSigner,
|
||||
// mockCollectData,
|
||||
// _getSigStruct(signerPrivKey, collectDigest, deadline)
|
||||
// )
|
||||
// );
|
||||
assertTrue(_getSigNonce(profileOwner) != nonce, 'Wrong nonce after collecting');
|
||||
|
||||
// // TODO fix
|
||||
// vm.expectRevert(Errors.SignatureInvalid.selector);
|
||||
// _mockCollectWithSig({delegatedSigner: address(0), signerPrivKey: otherSignerKey});
|
||||
vm.expectRevert(Errors.SignatureInvalid.selector);
|
||||
_mockCollectWithSig({delegatedSigner: address(0), signerPrivKey: profileOwnerKey});
|
||||
}
|
||||
|
||||
// SCENARIOS
|
||||
|
||||
@@ -393,4 +393,13 @@ contract BaseTest is TestSetup {
|
||||
function _getPubCount(uint256 profileId) internal view returns (uint256) {
|
||||
return hub.getPubCount(profileId);
|
||||
}
|
||||
|
||||
function _getCollectCount(uint256 profileId, uint256 pubId) internal view returns (uint256) {
|
||||
address collectNft = hub.getCollectNFT(profileId, pubId);
|
||||
if (collectNft == address(0)) {
|
||||
return 0;
|
||||
} else {
|
||||
return CollectNFT(collectNft).totalSupply();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user