-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: dry-ify the merkle tests (#1009)
test: polish shared tests
- Loading branch information
1 parent
14b48a6
commit 9c8ff1f
Showing
46 changed files
with
416 additions
and
524 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 90 additions & 0 deletions
90
test/periphery/integration/merkle-campaign/instant/MerkleInstant.t.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity >=0.8.22 <0.9.0; | ||
|
||
import { ISablierMerkleBase } from "src/periphery/interfaces/ISablierMerkleBase.sol"; | ||
|
||
import { Clawback_Integration_Test } from "../shared/clawback/clawback.t.sol"; | ||
import { GetFirstClaimTime_Integration_Test } from "../shared/get-first-claim-time/getFirstClaimTime.t.sol"; | ||
import { HasClaimed_Integration_Test } from "../shared/has-claimed/hasClaimed.t.sol"; | ||
import { HasExpired_Integration_Test } from "../shared/has-expired/hasExpired.t.sol"; | ||
import { MerkleCampaign_Integration_Shared_Test } from "../shared/MerkleCampaign.t.sol"; | ||
|
||
/*////////////////////////////////////////////////////////////////////////// | ||
NON-SHARED TESTS | ||
//////////////////////////////////////////////////////////////////////////*/ | ||
|
||
abstract contract MerkleInstant_Integration_Shared_Test is MerkleCampaign_Integration_Shared_Test { | ||
function setUp() public virtual override { | ||
MerkleCampaign_Integration_Shared_Test.setUp(); | ||
|
||
// Cast the {merkleInstant} contract as {ISablierMerkleBase} | ||
merkleBase = ISablierMerkleBase(merkleInstant); | ||
} | ||
} | ||
|
||
/*////////////////////////////////////////////////////////////////////////// | ||
SHARED TESTS | ||
//////////////////////////////////////////////////////////////////////////*/ | ||
|
||
contract Clawback_MerkleLInstant_Integration_Test is | ||
Clawback_Integration_Test, | ||
MerkleInstant_Integration_Shared_Test | ||
{ | ||
modifier afterFirstClaim() override { | ||
// Make the first claim to set `_firstClaimTime`. | ||
claimInstant(); | ||
_; | ||
} | ||
|
||
function setUp() public override(Clawback_Integration_Test, MerkleInstant_Integration_Shared_Test) { | ||
Clawback_Integration_Test.setUp(); | ||
MerkleInstant_Integration_Shared_Test.setUp(); | ||
} | ||
} | ||
|
||
contract GetFirstClaimTime_MerkleLInstant_Integration_Test is | ||
GetFirstClaimTime_Integration_Test, | ||
MerkleInstant_Integration_Shared_Test | ||
{ | ||
modifier afterFirstClaim() override { | ||
// Make the first claim to set `_firstClaimTime`. | ||
claimInstant(); | ||
_; | ||
} | ||
|
||
function setUp() public override(GetFirstClaimTime_Integration_Test, MerkleInstant_Integration_Shared_Test) { | ||
GetFirstClaimTime_Integration_Test.setUp(); | ||
MerkleInstant_Integration_Shared_Test.setUp(); | ||
} | ||
} | ||
|
||
contract HasClaimed_MerkleLInstant_Integration_Test is | ||
HasClaimed_Integration_Test, | ||
MerkleInstant_Integration_Shared_Test | ||
{ | ||
modifier givenRecipientHasClaimed() override { | ||
// Make the first claim to set `_firstClaimTime`. | ||
claimInstant(); | ||
_; | ||
} | ||
|
||
function setUp() public override(HasClaimed_Integration_Test, MerkleInstant_Integration_Shared_Test) { | ||
HasClaimed_Integration_Test.setUp(); | ||
MerkleInstant_Integration_Shared_Test.setUp(); | ||
} | ||
} | ||
|
||
contract HasExpired_MerkleLInstant_Integration_Test is | ||
HasExpired_Integration_Test, | ||
MerkleInstant_Integration_Shared_Test | ||
{ | ||
modifier createMerkleCampaignWithZeroExpiry() override { | ||
campaignWithZeroExpiry = ISablierMerkleBase(createMerkleInstant({ expiration: 0 })); | ||
_; | ||
} | ||
|
||
function setUp() public override(HasExpired_Integration_Test, MerkleInstant_Integration_Shared_Test) { | ||
HasExpired_Integration_Test.setUp(); | ||
MerkleInstant_Integration_Shared_Test.setUp(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 0 additions & 80 deletions
80
test/periphery/integration/merkle-campaign/instant/clawback/clawback.t.sol
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 0 additions & 22 deletions
22
...eriphery/integration/merkle-campaign/instant/get-first-claim-time/getFirstClaimTime.t.sol
This file was deleted.
Oops, something went wrong.
28 changes: 0 additions & 28 deletions
28
test/periphery/integration/merkle-campaign/instant/has-claimed/hasClaimed.t.sol
This file was deleted.
Oops, something went wrong.
31 changes: 0 additions & 31 deletions
31
test/periphery/integration/merkle-campaign/instant/has-expired/hasExpired.t.sol
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.