@@ -175,6 +175,32 @@ export const addDeployTestSteps = ({
175175 expect ( contract . getInt1 ( ) ) . to . be . rejectedWith ( 'execution reverted' )
176176 } )
177177
178+ it ( 'and can handle multiple removals from the same facet' , async ( ) => {
179+ writeFile ( join ( cwd , `${ contractSrcBasePath } /facets/ExampleFacet.sol` ) , `
180+ pragma solidity >=0.8.21;
181+ import "../libs/LibAppStorage.sol";
182+ contract ExampleFacet {
183+ function setInt2(uint i) external {
184+ AppStorage storage s = LibAppStorage.diamondStorage();
185+ s.data.i1 = i + 1;
186+ }
187+ }
188+ ` )
189+
190+ expect ( cli ( 'build' , { cwd } ) . success ) . to . be . true
191+ expect ( cli_deploy ( [ ] ) . success ) . to . be . true
192+
193+ const { contract } = await loadDiamondContract ( cwd , [
194+ 'function setInt2(uint i) external' ,
195+ 'function setInt1(uint i) external' ,
196+ 'function getInt1() external view returns (uint)' ,
197+ ] )
198+
199+ await sendTx ( contract . setInt2 ( 2 ) )
200+ await expect ( contract . setInt1 ( 2 ) ) . to . be . rejected
201+ await expect ( contract . getInt1 ( ) ) . to . be . rejected
202+ } )
203+
178204 it ( 'and can prevent removals of protected methods' , async ( ) => {
179205 writeFile ( join ( cwd , `${ contractSrcBasePath } /facets/ExampleFacet.sol` ) , `
180206 pragma solidity >=0.8.21;
@@ -972,4 +998,3 @@ export const addDeployTestSteps = ({
972998
973999 } )
9741000}
975-
0 commit comments