-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
5 changed files
with
82 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity >=0.8.22; | ||
|
||
import { Flow } from "src/types/DataTypes.sol"; | ||
|
||
import { Integration_Test } from "../../Integration.t.sol"; | ||
|
||
contract StatusOf_Integration_Concrete_Test is Integration_Test { | ||
function setUp() public override { | ||
Integration_Test.setUp(); | ||
|
||
depositDefaultAmountToDefaultStream(); | ||
} | ||
|
||
function test_RevertGiven_Null() external { | ||
bytes memory callData = abi.encodeCall(flow.statusOf, nullStreamId); | ||
expectRevert_Null(callData); | ||
} | ||
|
||
modifier givenInactive() { | ||
_; | ||
} | ||
|
||
function test_GivenStreamDoesHaveDebt() external givenNotNull givenInactive { | ||
vm.warp({ newTimestamp: WARP_SOLVENCY_PERIOD + 1 }); | ||
flow.pause(defaultStreamId); | ||
|
||
// it should return PAUSED_INSOLVENT | ||
uint8 actualStatus = uint8(flow.statusOf(defaultStreamId)); | ||
uint8 expectedStatus = uint8(Flow.Status.PAUSED_INSOLVENT); | ||
assertEq(actualStatus, expectedStatus); | ||
} | ||
|
||
function test_GivenStreamDoesNotHaveDebt() external givenNotNull givenInactive { | ||
flow.pause(defaultStreamId); | ||
|
||
// it should return PAUSED_SOLVENT | ||
uint8 actualStatus = uint8(flow.statusOf(defaultStreamId)); | ||
uint8 expectedStatus = uint8(Flow.Status.PAUSED_SOLVENT); | ||
assertEq(actualStatus, expectedStatus); | ||
} | ||
|
||
modifier givenActive() { | ||
_; | ||
} | ||
|
||
function test_GivenStreamHasDebt() external givenNotNull givenActive { | ||
vm.warp({ newTimestamp: WARP_SOLVENCY_PERIOD + 1 }); | ||
|
||
// it should return STREAMING_INSOLVENT | ||
uint8 actualStatus = uint8(flow.statusOf(defaultStreamId)); | ||
uint8 expectedStatus = uint8(Flow.Status.STREAMING_INSOLVENT); | ||
assertEq(actualStatus, expectedStatus); | ||
} | ||
|
||
function test_GivenStreamHasNoDebt() external view givenNotNull givenActive { | ||
// it should return STREAMING_SOLVENT | ||
uint8 actualStatus = uint8(flow.statusOf(defaultStreamId)); | ||
uint8 expectedStatus = uint8(Flow.Status.STREAMING_SOLVENT); | ||
assertEq(actualStatus, expectedStatus); | ||
} | ||
} |
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,14 @@ | ||
StatusOf_Integration_Concrete_Test | ||
βββ given null | ||
β βββ it should revert | ||
βββ given not null | ||
βββ given inactive | ||
β βββ given stream does have debt | ||
β β βββ it should return PAUSED_INSOLVENT | ||
β βββ given stream does not have debt | ||
β βββ it should return PAUSED_SOLVENT | ||
βββ given active | ||
βββ given stream has debt | ||
β βββ it should return STREAMING_INSOLVENT | ||
βββ given stream has no debt | ||
βββ it should return STREAMING_SOLVENT |