Skip to content

Commit

Permalink
Refactoring naming
Browse files Browse the repository at this point in the history
  • Loading branch information
Erikd-dev committed Aug 8, 2024
1 parent 2984625 commit 11e15a0
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions test/concrete/flowBasic/FlowConstructionTest.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// SPDX-License-Identifier: CAL
pragma solidity ^0.8.18;

import {Vm} from "forge-std/Test.sol";

import {EvaluableConfigV3} from "rain.interpreter.interface/interface/IInterpreterCallerV2.sol";
import {CloneFactory} from "rain.factory/src/concrete/CloneFactory.sol";
import {FlowBasicTest} from "test/abstract/FlowBasicTest.sol";

contract FlowConstructionTest is FlowBasicTest {
function testFlowConstructionInitialize(address expression, bytes memory bytecode, uint256[] memory constants)
external
{
expressionDeployerDeployExpression2MockCall(expression, bytes(hex"0007"));

EvaluableConfigV3[] memory flowConfig = new EvaluableConfigV3[](1);
flowConfig[0] = EvaluableConfigV3(iDeployer, bytecode, constants);

vm.recordLogs();
iCloneFactory.clone(address(iFlowImplementation), abi.encode(flowConfig));

Vm.Log[] memory logs = vm.getRecordedLogs();
bytes32 eventSignature = keccak256("Initialize(address,(address,bytes,uint256[])[])");

Vm.Log memory concreteEvent = findEvent(logs, eventSignature);
(address sender, EvaluableConfigV3[] memory config) =
abi.decode(concreteEvent.data, (address, EvaluableConfigV3[]));

assertEq(sender, address(iCloneFactory), "wrong sender in Initialize event");
assertEq(keccak256(abi.encode(flowConfig)), keccak256(abi.encode(config)), "wrong compare Structs");
}
}

0 comments on commit 11e15a0

Please sign in to comment.