From eab5cd457cfdd8d66e6589dcecca674b47d375c8 Mon Sep 17 00:00:00 2001 From: Austrian <114922365+0xAustrian@users.noreply.github.com> Date: Fri, 3 May 2024 15:08:32 -0300 Subject: [PATCH] test: improve BFactory.sol (#6) --- test/unit/BFactory.t.sol | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/test/unit/BFactory.t.sol b/test/unit/BFactory.t.sol index 62c87252..a4520222 100644 --- a/test/unit/BFactory.t.sol +++ b/test/unit/BFactory.t.sol @@ -56,21 +56,23 @@ contract BFactory_Unit_NewBPool is Base { /** * @notice Test that event is emitted */ - function test_Emit_Log() public { + function test_Emit_Log(address _randomCaller) public { + vm.assume(_randomCaller != VM_ADDRESS); vm.expectEmit(true, true, true, true); address _expectedPoolAddress = vm.computeCreateAddress(address(bFactory), 1); - emit BFactory.LOG_NEW_POOL(owner, _expectedPoolAddress); - vm.prank(owner); + emit BFactory.LOG_NEW_POOL(_randomCaller, _expectedPoolAddress); + vm.prank(_randomCaller); bFactory.newBPool(); } /** * @notice Test that msg.sender is set as the controller */ - function test_Set_Controller() public { - vm.prank(owner); - BPool _pool = new BPool(); - assertEq(owner, _pool.getController()); + function test_Set_Controller(address _randomCaller) public { + vm.assume(_randomCaller != VM_ADDRESS); + vm.prank(_randomCaller); + BPool _pool = bFactory.newBPool(); + assertEq(_randomCaller, _pool.getController()); } /**