Skip to content

Commit

Permalink
test: move tests to concrete dir (#135)
Browse files Browse the repository at this point in the history
  • Loading branch information
smol-ninja authored May 31, 2024
1 parent bd18ad2 commit aac36d5
Show file tree
Hide file tree
Showing 46 changed files with 53 additions and 52 deletions.
1 change: 1 addition & 0 deletions test/integration/Integration.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { Broker } from "src/types/DataTypes.sol";

import { Base_Test } from "../Base.t.sol";

/// @notice Common logic needed by all integration tests, both concrete and fuzz tests.
abstract contract Integration_Test is Base_Test {
Broker internal defaultBroker;
uint256 internal defaultStreamId;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ pragma solidity >=0.8.22;

import { Errors } from "src/libraries/Errors.sol";

import { Integration_Test } from "../Integration.t.sol";
import { Integration_Test } from "../../Integration.t.sol";

contract AdjustRatePerSecond_Integration_Test is Integration_Test {
contract AdjustRatePerSecond_Integration_Concrete_Test is Integration_Test {
function setUp() public override {
Integration_Test.setUp();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.22;

import { Integration_Test } from "../Integration.t.sol";
import { Integration_Test } from "../../Integration.t.sol";

contract AmountOwedOf_Integration_Test is Integration_Test {
contract AmountOwedOf_Integration_Concrete_Test is Integration_Test {
function setUp() public virtual override {
Integration_Test.setUp();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AmountOwedOf_Integration_Test
AmountOwedOf_Integration_Concrete_Test
β”œβ”€β”€ given null
β”‚ └── it should revert
└── given not null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ pragma solidity >=0.8.22;
import { UD60x18 } from "@prb/math/src/UD60x18.sol";
import { SablierFlow } from "src/SablierFlow.sol";

import { Integration_Test } from "./Integration.t.sol";
import { Integration_Test } from "../Integration.t.sol";

contract Constructor_Integration_Concrete_Test is Integration_Test {
function test_Constructor() external {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";

import { Flow } from "src/types/DataTypes.sol";

import { Integration_Test } from "../Integration.t.sol";
import { Integration_Test } from "../../Integration.t.sol";

contract CreateAndDepositViaBroker_Integration_Test is Integration_Test {
contract CreateAndDepositViaBroker_Integration_Concrete_Test is Integration_Test {
function test_RevertWhen_DelegateCall() external {
bytes memory callData = abi.encodeCall(
flow.createAndDepositViaBroker,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
CreateAndDepositViaBroker_Integration_Test
CreateAndDepositViaBroker_Integration_Concrete_Test
β”œβ”€β”€ when delegate call
β”‚ └── it should revert
└── when not delegate call
Expand All @@ -7,4 +7,4 @@ CreateAndDepositViaBroker_Integration_Test
β”œβ”€β”€ it should mint the NFT
β”œβ”€β”€ it should update the stream balance
β”œβ”€β”€ it should perform the ERC20 transfers
└── it should emit events: 1 {MetadataUpdate}, 1 {CreateFlowStream}, 2 {Transfer}, 1 {DepositFlowStream}
└── it should emit events: 1 {MetadataUpdate}, 1 {CreateFlowStream}, 2 {Transfer}, 1 {DepositFlowStream}
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import { Errors } from "src/libraries/Errors.sol";
import { Flow } from "src/types/DataTypes.sol";

import { Integration_Test } from "../Integration.t.sol";
import { Integration_Test } from "../../Integration.t.sol";

contract Create_Integration_Test is Integration_Test {
contract Create_Integration_Concrete_Test is Integration_Test {
function setUp() public override {
Integration_Test.setUp();
}
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.22;

import { Integration_Test } from "../Integration.t.sol";
import { Integration_Test } from "../../Integration.t.sol";

contract DepletionTimeOf_Integration_Test is Integration_Test {
contract DepletionTimeOf_Integration_Concrete_Test is Integration_Test {
function test_RevertGiven_Null() external {
bytes memory callData = abi.encodeCall(flow.depletionTimeOf, nullStreamId);
expectRevert_Null(callData);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
DepletionTimeOf_Integration_Test
DepletionTimeOf_Integration_Concrete_Test
β”œβ”€β”€ given null
β”‚ └── it should revert
└── given not null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ pragma solidity >=0.8.22;

import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";

import { Integration_Test } from "../Integration.t.sol";
import { Integration_Test } from "../../Integration.t.sol";

contract DepositAndPause_Integration_Test is Integration_Test {
contract DepositAndPause_Integration_Concrete_Test is Integration_Test {
function setUp() public override {
Integration_Test.setUp();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
DepositAndPause_Integration_Test
DepositAndPause_Integration_Concrete_Test
β”œβ”€β”€ when delegate called
β”‚ └── it should revert
└── when not delegate call
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import { ud } from "@prb/math/src/UD60x18.sol";
import { Errors } from "src/libraries/Errors.sol";
import { Broker } from "src/types/DataTypes.sol";

import { Integration_Test } from "../Integration.t.sol";
import { Integration_Test } from "../../Integration.t.sol";

contract DepositViaBroker_Integration_Test is Integration_Test {
contract DepositViaBroker_Integration_Concrete_Test is Integration_Test {
function test_RevertWhen_DelegateCall() external {
bytes memory callData =
abi.encodeCall(flow.depositViaBroker, (defaultStreamId, DEPOSIT_AMOUNT_WITH_BROKER_FEE, defaultBroker));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
DepositViaBroker_Integration_Test
DepositViaBroker_Integration_Concrete_Test
β”œβ”€β”€ when delegate call
β”‚ └── it should revert
└── when not delegate call
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";

import { Errors } from "src/libraries/Errors.sol";

import { Integration_Test } from "../Integration.t.sol";
import { Integration_Test } from "../../Integration.t.sol";

contract Deposit_Integration_Test is Integration_Test {
contract Deposit_Integration_Concrete_Test is Integration_Test {
function setUp() public override {
Integration_Test.setUp();
}
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.22;

import { Integration_Test } from "../Integration.t.sol";
import { Integration_Test } from "../../Integration.t.sol";

contract Pause_Integration_Test is Integration_Test {
contract Pause_Integration_Concrete_Test is Integration_Test {
function setUp() public override {
Integration_Test.setUp();

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.22;

import { Integration_Test } from "../Integration.t.sol";
import { Integration_Test } from "../../Integration.t.sol";

contract RecentAmountOf_Integration_Test is Integration_Test {
contract RecentAmountOf_Integration_Concrete_Test is Integration_Test {
function setUp() public override {
Integration_Test.setUp();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ pragma solidity >=0.8.22;

import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";

import { Integration_Test } from "../Integration.t.sol";
import { Integration_Test } from "../../Integration.t.sol";

contract RefundAndPause_Integration_Test is Integration_Test {
contract RefundAndPause_Integration_Concrete_Test is Integration_Test {
function setUp() public override {
Integration_Test.setUp();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
RefundAndPause_Integration_Test
RefundAndPause_Integration_Concrete_Test
β”œβ”€β”€ when delegate call
β”‚ └── it should revert
└── when not delegate call
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";

import { Errors } from "src/libraries/Errors.sol";

import { Integration_Test } from "../Integration.t.sol";
import { Integration_Test } from "../../Integration.t.sol";

contract Refund_Integration_Test is Integration_Test {
contract Refund_Integration_Concrete_Test is Integration_Test {
function setUp() public override {
Integration_Test.setUp();

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.22;

import { Integration_Test } from "../Integration.t.sol";
import { Integration_Test } from "../../Integration.t.sol";

contract RefundableAmountOf_Integration_Test is Integration_Test {
contract RefundableAmountOf_Integration_Concrete_Test is Integration_Test {
function setUp() public override {
Integration_Test.setUp();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ pragma solidity >=0.8.22;

import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";

import { Integration_Test } from "../Integration.t.sol";
import { Integration_Test } from "../../Integration.t.sol";

contract RestartAndDeposit_Integration_Test is Integration_Test {
contract RestartAndDeposit_Integration_Concrete_Test is Integration_Test {
function setUp() public override {
Integration_Test.setUp();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ pragma solidity >=0.8.22;

import { Errors } from "src/libraries/Errors.sol";

import { Integration_Test } from "../Integration.t.sol";
import { Integration_Test } from "../../Integration.t.sol";

contract Restart_Integration_Test is Integration_Test {
contract Restart_Integration_Concrete_Test is Integration_Test {
function setUp() public override {
Integration_Test.setUp();

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ pragma solidity >=0.8.22;
import { Errors } from "src/libraries/Errors.sol";
import { SablierFlowNFTDescriptor } from "src/SablierFlowNFTDescriptor.sol";

import { Integration_Test } from "../Integration.t.sol";
import { Integration_Test } from "../../Integration.t.sol";

contract SetNFTDescriptor_Integration_Test is Integration_Test {
contract SetNFTDescriptor_Integration_Concrete_Test is Integration_Test {
function setUp() public virtual override {
Integration_Test.setUp();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SetNFTDescriptor_Integration_Test
SetNFTDescriptor_Integration_Concrete_Test
β”œβ”€β”€ when caller is not admin
β”‚ └── it should revert
└── when caller is admin
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.22;

import { Integration_Test } from "../Integration.t.sol";
import { Integration_Test } from "../../Integration.t.sol";

contract StreamDebtOf_Integration_Test is Integration_Test {
contract StreamDebtOf_Integration_Concrete_Test is Integration_Test {
function setUp() public override {
Integration_Test.setUp();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ pragma solidity >=0.8.22;

import { IERC721Errors } from "@openzeppelin/contracts/interfaces/draft-IERC6093.sol";

import { Integration_Test } from "../Integration.t.sol";
import { Integration_Test } from "../../Integration.t.sol";

contract TokenURI_Integration_Test is Integration_Test {
contract TokenURI_Integration_Concrete_Test is Integration_Test {
function test_RevertGiven_NFTDoesNotExist() external {
vm.expectRevert(abi.encodeWithSelector(IERC721Errors.ERC721NonexistentToken.selector, nullStreamId));
flow.tokenURI({ streamId: nullStreamId });
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
TokenURI_Integration_Test
TokenURI_Integration_Concrete_Test
β”œβ”€β”€ given NFT does not exist
β”‚ └── it should revert
└── given NFT exists
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity >=0.8.22 <0.9.0;

import { Errors } from "src/libraries/Errors.sol";

import { Integration_Test } from "../Integration.t.sol";
import { Integration_Test } from "../../Integration.t.sol";

contract TransferFrom_Integration_Concrete_Test is Integration_Test {
function setUp() public virtual override {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";

import { Errors } from "src/libraries/Errors.sol";

import { Integration_Test } from "../Integration.t.sol";
import { Integration_Test } from "../../Integration.t.sol";

contract WithdrawAt_Integration_Test is Integration_Test {
contract WithdrawAt_Integration_Concrete_Test is Integration_Test {
function setUp() public override {
Integration_Test.setUp();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity >=0.8.22;

import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";

import { Integration_Test } from "../Integration.t.sol";
import { Integration_Test } from "../../Integration.t.sol";

contract WithdrawMax_Integration_Concrete_Test is Integration_Test {
function setUp() public override {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.8.22;

import { Integration_Test } from "../Integration.t.sol";
import { Integration_Test } from "../../Integration.t.sol";

contract WithdrawableAmountOf_Integration_Test is Integration_Test {
contract WithdrawableAmountOf_Integration_Concrete_Test is Integration_Test {
function setUp() public override {
Integration_Test.setUp();
}
Expand Down

0 comments on commit aac36d5

Please sign in to comment.