Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: replaced testFail Foundry tests with ordinary tests #45

Merged
merged 1 commit into from
Jan 9, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 11 additions & 29 deletions tests/extensions/v3-config-engine/AaveV3ConfigEngineTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
pragma solidity ^0.8.0;

import 'forge-std/Test.sol';
import {VmSafe} from 'forge-std/Base.sol';
import {IAaveV3ConfigEngine} from '../../../src/contracts/extensions/v3-config-engine/IAaveV3ConfigEngine.sol';
import {AaveV3MockListing} from './mocks/AaveV3MockListing.sol';
import {AaveV3MockListingCustom} from './mocks/AaveV3MockListingCustom.sol';
Expand Down Expand Up @@ -301,7 +302,7 @@ contract AaveV3ConfigEngineTest is TestnetProcedures, ProtocolV3TestBase {
// engine doesn't call the POOL_CONFIGURATOR.
// So the solution is expecting the event emitted on the POOL_CONFIGURATOR,
// and as this doesn't happen, expect the failure of the test
function testFailCollateralsUpdatesNoChange() public {
function testCollateralsUpdatesNoChangeShouldNotEmit() public {
// this asset has been listed before
address asset = tokenList.usdx;
AaveV3MockCollateralUpdateNoChange payload = new AaveV3MockCollateralUpdateNoChange(
Expand All @@ -312,22 +313,13 @@ contract AaveV3ConfigEngineTest is TestnetProcedures, ProtocolV3TestBase {
vm.prank(roleList.marketOwner);
contracts.aclManager.addPoolAdmin(address(payload));

ReserveConfig[] memory allConfigsBefore = createConfigurationSnapshot(
'preTestEngineCollateralNoChange',
IPool(address(contracts.poolProxy))
);

vm.expectEmit();
emit CollateralConfigurationChanged(
allConfigsBefore[0].underlying,
allConfigsBefore[0].ltv,
allConfigsBefore[0].liquidationThreshold,
allConfigsBefore[0].liquidationBonus
);
payload.execute();

VmSafe.Log[] memory emittedLogs = vm.getRecordedLogs();
assertEq(emittedLogs.length, 0);
}

// Same as testFailCollateralsUpdatesNoChange, but this time should work, as we are not expecting any event emitted
// Same as testCollateralsUpdatesNoChangeShouldNotEmit, but this time should work, as we are not expecting any event emitted
function testCollateralsUpdatesNoChange() public {
// this asset has been listed before
address asset = tokenList.usdx;
Expand Down Expand Up @@ -563,31 +555,21 @@ contract AaveV3ConfigEngineTest is TestnetProcedures, ProtocolV3TestBase {
}

// TODO manage this after testFail* deprecation.
function testFailEModeCategoryUpdatesNoChange() public {
function testEModeCategoryUpdatesNoChangeShouldNotEmit() public {
AaveV3MockEModeCategoryUpdateNoChange payload = new AaveV3MockEModeCategoryUpdateNoChange(
configEngine
);

DataTypes.EModeCategoryLegacy memory eModeCategoryDataBefore = contracts
.poolProxy
.getEModeCategoryData(1);

vm.prank(roleList.marketOwner);
contracts.aclManager.addPoolAdmin(address(payload));

vm.expectEmit(true, true, true, true);
emit EModeCategoryAdded(
1,
eModeCategoryDataBefore.ltv,
eModeCategoryDataBefore.liquidationThreshold,
eModeCategoryDataBefore.liquidationBonus,
address(0),
eModeCategoryDataBefore.label
);
payload.execute();

VmSafe.Log[] memory emittedLogs = vm.getRecordedLogs();
assertEq(emittedLogs.length, 0);
}

// Same as testFailEModeCategoryUpdatesNoChange, but this time should work, as we are not expecting any event emitted
// Same as testEModeCategoryUpdatesNoChangeShouldNotEmit, but this time should work, as we are not expecting any event emitted
function testEModeCategoryUpdatesNoChange() public {
AaveV3MockEModeCategoryUpdateNoChange payload = new AaveV3MockEModeCategoryUpdateNoChange(
configEngine
Expand Down
Loading