From c630e217c236bea6c7f0a190e1d14bf52a1d2406 Mon Sep 17 00:00:00 2001 From: Dhruv-Varshney-Developer Date: Sun, 22 Dec 2024 00:01:53 +0530 Subject: [PATCH] test: Added tests for Base_SpokePool Signed-off-by: Dhruv-Varshney-Developer --- .../Base_SpokePool.ts | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/test/evm/hardhat/chain-specific-spokepools/Base_SpokePool.ts b/test/evm/hardhat/chain-specific-spokepools/Base_SpokePool.ts index 9558632d5..cece79c41 100644 --- a/test/evm/hardhat/chain-specific-spokepools/Base_SpokePool.ts +++ b/test/evm/hardhat/chain-specific-spokepools/Base_SpokePool.ts @@ -8,7 +8,6 @@ let hubPool: Contract, spokePool: Contract, weth: Contract, usdc: Contract; let owner: SignerWithAddress; let cctpTokenMessenger: FakeContract; -// ABI for CCTP Token Messenger const tokenMessengerAbi = [ { inputs: [], @@ -25,12 +24,10 @@ describe("Base Spoke Pool", function () { ({ weth, usdc, hubPool } = await hubPoolFixture()); cctpTokenMessenger = await smock.fake(tokenMessengerAbi); - cctpTokenMessenger.localToken.returns(usdc.address); - // Deploy Base SpokePool spokePool = await hre.upgrades.deployProxy( await getContractFactory("Base_SpokePool", owner), - [0, hubPool.address, hubPool.address], + [0, owner.address, hubPool.address], { kind: "uups", unsafeAllow: ["delegatecall"], @@ -40,21 +37,26 @@ describe("Base Spoke Pool", function () { }); describe("Initialization", function () { - it("Should initialize with correct parameters", async function () { - expect(await spokePool._l2Usdc).to.equal(usdc.address); + it("Should initialize with correct constructor parameters", async function () { + expect(await spokePool.wrappedNativeToken()).to.equal(weth.address); + expect(await spokePool.usdcToken()).to.equal(usdc.address); expect(await spokePool.cctpTokenMessenger()).to.equal(cctpTokenMessenger.address); }); - it("Should start with deposit ID 0", async function () { + it("Should initialize with correct proxy parameters", async function () { expect(await spokePool.numberOfDeposits()).to.equal(0); + expect(await spokePool.crossDomainAdmin()).to.equal(owner.address); + expect(await spokePool.withdrawalRecipient()).to.equal(hubPool.address); + }); + + it("Should initialize with correct OVM_ETH", async function () { + expect(await spokePool.l2Eth()).to.equal("0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000"); }); }); describe("Error cases", function () { - it("Should revert if trying to initialize twice", async function () { - await expect(spokePool.initialize(0, hubPool.address, hubPool.address)).to.be.revertedWith( - "Initializable: contract is already initialized" - ); + it("Should revert on reinitialization", async function () { + await expect(spokePool.connect(owner).initialize(0, owner.address, hubPool.address)).to.be.reverted; }); }); });